;;;===========================================================================
;;;
;;; Cone Equivalence Theorem
;;;
;;;---------------------------------------------------------------------------
;;;
;;; JHV 
;;;
;;; Start date: 10/05/10 || End date: 14/05/10
;;;
;;;===========================================================================


(in-package "ACL2")

(include-book "cone-structure")

(encapsulate
 
 ;;**************************************************
 ;; Signaturas
 ;;**************************************************

 (
 ;;--------------------------------------------------
 ;; The signatures of the ring R
 ;;--------------------------------------------------

 ;; Characteristic function
 ((inv-ring-Z *) => *)
 ;; Addition operation ring
 ((addition-ring-Z * *)=> *)
 ;; Product operation ring
 ((product-ring-Z * *) => *)
 ;; Inverse ring
 ((inverse-Z *) => *)
 ;; Zero element ring
 ((zero-element-Z ) => *)
 ;; Unit element ring
 ((unit-Z )=> *)

 ;;--------------------------------------------------
 ;; First homotopy equivalence C1 <<= D1 =>> H1
 ;;--------------------------------------------------

 ;;--------------------------------------------------
 ;; C1 Chain Complex (A R-Module)
 ;;--------------------------------------------------

 ;; Characteristic function
 ((inv-C1 * *) => *)
 ;; Group Operation 
 ((group-operation-C1 * * *) => *)
 ;; Zero element
 ((zero-C1 *) => *)
 ;; External multiplication
 ((external-C1 * * *) => *)
 ;; Inverse element
 ((inverse-C1 * *) => *)

 ;;--------------------------------------------------
 ;; The C1 differential 
 ;;--------------------------------------------------

 ;; The differential
 ((d-C1 * *) => *)

 ;;--------------------------------------------------
 ;; D1 Chain Complex (A R-Module)
 ;;--------------------------------------------------

 ;; Characteristic function
 ((inv-D1 * *) => *)
 ;; Group Operation 
 ((group-operation-D1 * * *) => *)
 ;; Zero element
 ((zero-D1 *) => *)
 ;; External multiplication
 ((external-D1 * * *) => *)
 ;; Inverse element
 ((inverse-D1 * *) => *)

 ;;--------------------------------------------------
 ;; The D1 differential 
 ;;--------------------------------------------------

 ;; The differential
 ((d-D1 * *) => *)

  ;;--------------------------------------------------
 ;; H1 Chain Complex (A R-Module)
 ;;--------------------------------------------------

 ;; Characteristic function
 ((inv-H1 * *) => *)
 ;; Group Operation 
 ((group-operation-H1 * * *) => *)
 ;; Zero element
 ((zero-H1 *) => *)
 ;; External multiplication
 ((external-H1 * * *) => *)
 ;; Inverse element
 ((inverse-H1 * *) => *)

 ;;--------------------------------------------------
 ;; The H1 differential 
 ;;--------------------------------------------------

 ;; The differential
 ((d-H1 * *) => *)

 ;;--------------------------------------------------
 ;; Second homotopy equivalence C2 <<= D2 =>> H2
 ;;--------------------------------------------------


 ;;--------------------------------------------------
 ;; C2 Chain Complex (A R-Module)
 ;;--------------------------------------------------

 ;; Characteristic function
 ((inv-C2 * *) => *)
 ;; Group Operation 
 ((group-operation-C2 * * *) => *)
 ;; Zero element
 ((zero-C2 *) => *)
 ;; External multiplication
 ((external-C2 * * *) => *)
 ;; Inverse element
 ((inverse-C2 * *) => *)

 ;;--------------------------------------------------
 ;; The C2 differential 
 ;;--------------------------------------------------

 ;; The differential
 ((d-C2 * *) => *)

 ;;--------------------------------------------------
 ;; D2 Chain Complex (A R-Module)
 ;;--------------------------------------------------

 ;; Characteristic function
 ((inv-D2 * *) => *)
 ;; Group Operation 
 ((group-operation-D2 * * *) => *)
 ;; Zero element
 ((zero-D2 *) => *)
 ;; External multiplication
 ((external-D2 * * *) => *)
 ;; Inverse element
 ((inverse-D2 * *) => *)

 ;;--------------------------------------------------
 ;; The D2 differential 
 ;;--------------------------------------------------

 ;; The differential
 ((d-D2 * *) => *)

  ;;--------------------------------------------------
 ;; H2 Chain Complex (A R-Module)
 ;;--------------------------------------------------

 ;; Characteristic function
 ((inv-H2 * *) => *)
 ;; Group Operation 
 ((group-operation-H2 * * *) => *)
 ;; Zero element
 ((zero-H2 *) => *)
 ;; External multiplication
 ((external-H2 * * *) => *)
 ;; Inverse element
 ((inverse-H2 * *) => *)

 ;;--------------------------------------------------
 ;; The H2 differential 
 ;;--------------------------------------------------

 ;; The differential
 ((d-H2 * *) => *)

 
 ;;--------------------------------------------------
 ;; Morphisms of the first homotopy equivalence
 ;;--------------------------------------------------

 ;;--------------------------------------------------
 ;; The lf1 morphism
 ;;--------------------------------------------------

 ;; The function
 ((lf1 * *) => *)

 ;;--------------------------------------------------
 ;; The lg1 C1 morphism
 ;;--------------------------------------------------

 ;; The function
 ((lg1 * *) => *)


 ;;--------------------------------------------------
 ;; The lh1 C1 morphism
 ;;--------------------------------------------------

 ;; The function
 ((lh1 * *) => *)

 ;;--------------------------------------------------
 ;; The rf1 morphism
 ;;--------------------------------------------------

 ;; The function
 ((rf1 * *) => *)

 ;;--------------------------------------------------
 ;; The rg1 C1 morphism
 ;;--------------------------------------------------

 ;; The function
 ((rg1 * *) => *)


 ;;--------------------------------------------------
 ;; The rh1 C1 morphism
 ;;--------------------------------------------------

 ;; The function
 ((rh1 * *) => *)

 ;;--------------------------------------------------
 ;; The lf2 morphism
 ;;--------------------------------------------------

 ;; The function
 ((lf2 * *) => *)

 ;;--------------------------------------------------
 ;; The lg2 C2 morphism
 ;;--------------------------------------------------

 ;; The function
 ((lg2 * *) => *)


 ;;--------------------------------------------------
 ;; The lh2 C2 morphism
 ;;--------------------------------------------------

 ;; The function
 ((lh2 * *) => *)

 ;;--------------------------------------------------
 ;; The rf2 morphism
 ;;--------------------------------------------------

 ;; The function
 ((rf2 * *) => *)

 ;;--------------------------------------------------
 ;; The rg2 C2 morphism
 ;;--------------------------------------------------

 ;; The function
 ((rg2 * *) => *)


 ;;--------------------------------------------------
 ;; The rh2 C2 morphism
 ;;--------------------------------------------------

 ;; The function
 ((rh2 * *) => *)


 ;;--------------------------------------------------
 ;; The morphism phi-c2-c1: C2 -> C1
 ;;--------------------------------------------------

 ;; The function
 ((phi-c2-c1 * *) => *)
 
 )
 ;;**************************************************
 ;; Witnesses
 ;;**************************************************
 
 ;;--------------------------------------------------
 ;; The witnesses of the ring Z
 ;;--------------------------------------------------

 ;; The characteristic function

 (local (defun inv-ring-Z (a)
	  (integerp a)))
 
 ;; Addition operation Z
 (local (defun addition-ring-Z (a b)
	  (+ a b)))

 ;; Product operation ring
 (local (defun product-ring-Z (a b)
	  (* a b)))

 ;; Inverse addition
 (local (defun inverse-Z (a)
	  (- a)))

 ;; Zero element ring
 (local (defun zero-element-Z nil
	  0))

 ;; Unit element ring
 (local (defun unit-Z nil
	  1))

 ;;--------------------------------------------------
 ;; C1 Chain Complex (A R-Module)
 ;;--------------------------------------------------

 ;; Characteristic function
 (local (defun inv-C1 (n a) 
	  (declare (ignore n))
	  (equal a 0)))

 ;; Group Operation 
 (local (defun group-operation-C1 (n a b)
	  (declare (ignore n))
	  (+ a b)))

 ;; Zero element
 (local (defun zero-C1 (n)
	  (declare (ignore n))
	  0))

 ;; External multiplication
 (local (defun external-C1 (n a b)
	  (declare (ignore n))
	  (* a b)))

 ;; Inverse element
 (local (defun inverse-C1 (n a)
	  (declare (ignore n a))
	  0))


 ;;--------------------------------------------------
 ;; The C1 differential 
 ;;--------------------------------------------------

 ;; The differential
 (local (defun d-C1 (n a)
	  (declare (ignore n a))
	  0))

 ;;--------------------------------------------------
 ;; D1 Chain Complex (A R-Module)
 ;;--------------------------------------------------

 ;; Characteristic function
 (local (defun inv-D1 (n a) 
	  (declare (ignore n))
	  (equal a 0)))

 ;; Group Operation 
 (local (defun group-operation-D1 (n a b)
	  (declare (ignore n))
	  (+ a b)))

 ;; Zero element
 (local (defun zero-D1 (n)
	  (declare (ignore n))
	  0))

 ;; External multiplication
 (local (defun external-D1 (n a b)
	  (declare (ignore n))
	  (* a b)))

 ;; Inverse element
 (local (defun inverse-D1 (n a)
	  (declare (ignore n a))
	  0))

 ;;--------------------------------------------------
 ;; The D1 differential 
 ;;--------------------------------------------------

 ;; The differential
 (local (defun d-D1 (n a)
	  (declare (ignore n a))
	  0))

  ;;--------------------------------------------------
 ;; H1 Chain Complex (A R-Module)
 ;;--------------------------------------------------

 ;; Characteristic function
 (local (defun inv-H1 (n a) 
	  (declare (ignore n))
	  (equal a 0)))

 ;; Group Operation 
 (local (defun group-operation-H1 (n a b)
	  (declare (ignore n))
	  (+ a b)))

 ;; Zero element
 (local (defun zero-H1 (n)
	  (declare (ignore n))
	  0))

 ;; External multiplication
 (local (defun external-H1 (n a b)
	  (declare (ignore n))
	  (* a b)))

 ;; Inverse element
 (local (defun inverse-H1 (n a)
	  (declare (ignore n a))
	  0))

 ;;--------------------------------------------------
 ;; The H1 differential 
 ;;--------------------------------------------------

 ;; The differential
 (local (defun d-H1 (n a)
	  (declare (ignore n a))
	  0))



 ;;--------------------------------------------------
 ;; C2 Chain Complex (A R-Module)
 ;;--------------------------------------------------

 ;; Characteristic function
 (local (defun inv-C2 (n a) 
	  (declare (ignore n))
	  (equal a 0)))

 ;; Group Operation 
 (local (defun group-operation-C2 (n a b)
	  (declare (ignore n))
	  (+ a b)))

 ;; Zero element
 (local (defun zero-C2 (n)
	  (declare (ignore n))
	  0))

 ;; External multiplication
 (local (defun external-C2 (n a b)
	  (declare (ignore n))
	  (* a b)))

 ;; Inverse element
 (local (defun inverse-C2 (n a)
	  (declare (ignore n a))
	  0))


 ;;--------------------------------------------------
 ;; The C2 differential 
 ;;--------------------------------------------------

 ;; The differential
 (local (defun d-C2 (n a)
	  (declare (ignore n a))
	  0))

 ;;--------------------------------------------------
 ;; D2 Chain Complex (A R-Module)
 ;;--------------------------------------------------

 ;; Characteristic function
 (local (defun inv-D2 (n a) 
	  (declare (ignore n))
	  (equal a 0)))

 ;; Group Operation 
 (local (defun group-operation-D2 (n a b)
	  (declare (ignore n))
	  (+ a b)))

 ;; Zero element
 (local (defun zero-D2 (n)
	  (declare (ignore n))
	  0))

 ;; External multiplication
 (local (defun external-D2 (n a b)
	  (declare (ignore n))
	  (* a b)))

 ;; Inverse element
 (local (defun inverse-D2 (n a)
	  (declare (ignore n a))
	  0))

 ;;--------------------------------------------------
 ;; The D2 differential 
 ;;--------------------------------------------------

 ;; The differential
 (local (defun d-D2 (n a)
	  (declare (ignore n a))
	  0))


  ;;--------------------------------------------------
 ;; H2 Chain Complex (A R-Module)
 ;;--------------------------------------------------

 ;; Characteristic function
 (local (defun inv-H2 (n a) 
	  (declare (ignore n))
	  (equal a 0)))

 ;; Group Operation 
 (local (defun group-operation-H2 (n a b)
	  (declare (ignore n))
	  (+ a b)))

 ;; Zero element
 (local (defun zero-H2 (n)
	  (declare (ignore n))
	  0))

 ;; External multiplication
 (local (defun external-H2 (n a b)
	  (declare (ignore n))
	  (* a b)))

 ;; Inverse element
 (local (defun inverse-H2 (n a)
	  (declare (ignore n a))
	  0))

 ;;--------------------------------------------------
 ;; The H2 differential 
 ;;--------------------------------------------------

 ;; The differential
 (local (defun d-H2 (n a)
	  (declare (ignore n a))
	  0))
 


 ;;--------------------------------------------------
 ;; The lf1 morphism
 ;;--------------------------------------------------

 ;; The function
 (local (defun lf1 (n a)
	  (declare (ignore n a))
	  0))


 ;;--------------------------------------------------
 ;; The lg1 morphism
 ;;--------------------------------------------------

 ;; The function
 (local (defun lg1 (n a)
	  (declare (ignore n a))
	  0))

 

 ;;--------------------------------------------------
 ;; The lh1 morphism
 ;;--------------------------------------------------

 ;; The function
 (local (defun lh1 (n a)
	  (declare (ignore n a))
	  0))


;;--------------------------------------------------
 ;; The rf1 morphism
 ;;--------------------------------------------------

 ;; The function
 (local (defun rf1 (n a)
	  (declare (ignore n a))
	  0))


 ;;--------------------------------------------------
 ;; The rg1 morphism
 ;;--------------------------------------------------

 ;; The function
 (local (defun rg1 (n a)
	  (declare (ignore n a))
	  0))

 

 ;;--------------------------------------------------
 ;; The rh1 morphism
 ;;--------------------------------------------------

 ;; The function
 (local (defun rh1 (n a)
	  (declare (ignore n a))
	  0))



 ;;--------------------------------------------------
 ;; The lf2 morphism
 ;;--------------------------------------------------

 ;; The function
 (local (defun lf2 (n a)
	  (declare (ignore n a))
	  0))


 ;;--------------------------------------------------
 ;; The lg2 morphism
 ;;--------------------------------------------------

 ;; The function
 (local (defun lg2 (n a)
	  (declare (ignore n a))
	  0))

 

 ;;--------------------------------------------------
 ;; The lh2 morphism
 ;;--------------------------------------------------

 ;; The function
 (local (defun lh2 (n a)
	  (declare (ignore n a))
	  0))


;;--------------------------------------------------
 ;; The rf2 morphism
 ;;--------------------------------------------------

 ;; The function
 (local (defun rf2 (n a)
	  (declare (ignore n a))
	  0))


 ;;--------------------------------------------------
 ;; The rg2 morphism
 ;;--------------------------------------------------

 ;; The function
 (local (defun rg2 (n a)
	  (declare (ignore n a))
	  0))

 

 ;;--------------------------------------------------
 ;; The lh2 morphism
 ;;--------------------------------------------------

 ;; The function
 (local (defun rh2 (n a)
	  (declare (ignore n a))
	  0))


 

 ;;--------------------------------------------------
 ;; The morphism
 ;;--------------------------------------------------

 ;; The function
 (local (defun phi-c2-c1 (n a)
	  (declare (ignore n a))
	  0))


  ;;************************************************** 
  ;; Properties
  ;;************************************************** 

(check-heq-p
(heq
 (reduction 
 (chain-complex 
  'inv-ring-Z 'addition-ring-Z 'zero-element-Z 'inverse-Z 'product-ring-Z 'unit-Z 
   'inv-D1 'group-operation-D1 'zero-D1 'external-D1 'inverse-D1 'd-D1 )
 (chain-complex 
   'inv-ring-Z 'addition-ring-Z 'zero-element-Z 'inverse-Z 'product-ring-Z 'unit-Z
    'inv-C1 'group-operation-C1 'zero-C1 'external-C1 'inverse-C1 'd-C1 )
  'lf1  'lg1  'lh1
  )
 (reduction 
 (chain-complex 
  'inv-ring-Z 'addition-ring-Z 'zero-element-Z 'inverse-Z 'product-ring-Z 'unit-Z 
   'inv-D1 'group-operation-D1 'zero-D1 'external-D1 'inverse-D1 'd-D1 )
 (chain-complex 
   'inv-ring-Z 'addition-ring-Z 'zero-element-Z 'inverse-Z 'product-ring-Z 'unit-Z
    'inv-H1 'group-operation-H1 'zero-H1 'external-H1 'inverse-H1 'd-H1 )
  'rf1  'rg1  'rh1
  ))
 'homotopy-equivalence-1
   )


(check-heq-p
(heq
 (reduction 
 (chain-complex 
  'inv-ring-Z 'addition-ring-Z 'zero-element-Z 'inverse-Z 'product-ring-Z 'unit-Z 
   'inv-D2 'group-operation-D2 'zero-D2 'external-D2 'inverse-D2 'd-D2 )
 (chain-complex 
   'inv-ring-Z 'addition-ring-Z 'zero-element-Z 'inverse-Z 'product-ring-Z 'unit-Z
    'inv-C2 'group-operation-C2 'zero-C2 'external-C2 'inverse-C2 'd-C2 )
  'lf2  'lg2  'lh2
  )
 (reduction 
 (chain-complex 
  'inv-ring-Z 'addition-ring-Z 'zero-element-Z 'inverse-Z 'product-ring-Z 'unit-Z 
   'inv-D2 'group-operation-D2 'zero-D2 'external-D2 'inverse-D2 'd-D2 )
 (chain-complex 
   'inv-ring-Z 'addition-ring-Z 'zero-element-Z 'inverse-Z 'product-ring-Z 'unit-Z
    'inv-H2 'group-operation-H2 'zero-H2 'external-H2 'inverse-H2 'd-H2 )
  'rf2  'rg2  'rh2
  ))
 'homotopy-equivalence-2
   )


(check-chain-complex-morphism-degree-0-p
(chain-complex-morphism-degree-0 
 (chain-complex 'inv-ring-Z 'addition-ring-Z 'zero-element-Z 'inverse-Z 'product-ring-Z 'unit-Z 'inv-C2 'group-operation-C2 'zero-C2 'external-C2 'inverse-C2 'd-C2 )
 (chain-complex 'inv-ring-Z 'addition-ring-Z 'zero-element-Z 'inverse-Z 'product-ring-Z 'unit-Z 'inv-C1 'group-operation-C1 'zero-C1 'external-C1 'inverse-C1 'd-C1 )
 'phi-c2-c1) 'phi-c2-c1)

)

)


;;==================================================
;; The Cone definitions
;;==================================================

;;--------------------------------------------------
;; Cone from phi: C2 -> C1
;;--------------------------------------------------

(encapsulate 

 ()
 
(local (defchain-complex inv-ring-Z addition-ring-Z zero-element-Z inverse-Z product-ring-Z unit-Z
	 inv-C2 group-operation-C2 zero-C2 external-C2 inverse-C2 d-C2 C2
	 :hints (("Goal" :use ((:instance |HOMOTOPY-EQUIVALENCE-2-is-an-homotopy-equivalence|))))))

(local (defchain-complex inv-ring-Z addition-ring-Z zero-element-Z inverse-Z product-ring-Z unit-Z
	 inv-C1 group-operation-C1 zero-C1 external-C1 inverse-C1 d-C1 C1
	 :hints (("Goal" :use ((:instance |HOMOTOPY-EQUIVALENCE-1-is-an-homotopy-equivalence|))))))

(in-theory (disable COMMUTATIVITY-OF-+))

(local (defthm help1 (IMPLIES (AND (INV-C2 N A)
              (INV-C2 N B)
              (INV-C2 N C)
	      (integerp n))
         (EQUAL (GROUP-OPERATION-C2 N (GROUP-OPERATION-C2 N A B) C)
                (GROUP-OPERATION-C2 N A (GROUP-OPERATION-C2 N B C)))) 
:hints (("Goal" :use ((:instance |C2-is-a-chain-complex|))))))

(local (defthm help3 (IMPLIES (AND (INV-C1 N A)
              (INV-C1 N B)
              (INV-C1 N C)
	      (integerp n))
         (EQUAL (GROUP-OPERATION-C1 N (GROUP-OPERATION-C1 N A B) C)
                (GROUP-OPERATION-C1 N A (GROUP-OPERATION-C1 N B C)))) 
:hints (("Goal" :use ((:instance |C1-is-a-chain-complex|))))))

(definstance-*cone*
  ((inv-ring inv-ring-Z)
    (addition-ring addition-ring-Z)
    (product-ring product-ring-Z)
    (inverse inverse-Z)
    (zero-element zero-element-Z)
    (unit unit-Z)
    (inv-D inv-C2)
    (group-operation-D group-operation-C2)
    (zero-D zero-C2)
    (external-D external-C2)
    (inverse-D inverse-C2)
    (d-D d-C2)
    (inv-C inv-C1) 
    (group-operation-C group-operation-C1)
    (zero-C zero-C1)
    (external-C external-C1)
    (inverse-C inverse-C1)
    (d-C d-C1)    
    (phi phi-c2-c1))
  "-cone-C2-C1")
)


;;--------------------------------------------------
;; Cone from dphi: D2 -> D1
;;--------------------------------------------------

(defun phi-d2-d1 (n a)
  (lg1 n (phi-c2-c1 n (lf2 n a))))

(encapsulate 

 ()

(local (defchain-complex inv-ring-Z addition-ring-Z zero-element-Z inverse-Z product-ring-Z unit-Z
	 inv-D2 group-operation-D2 zero-D2 external-D2 inverse-D2 d-D2 D2
	 :hints (("Goal" :use ((:instance |HOMOTOPY-EQUIVALENCE-2-is-an-homotopy-equivalence|))))))

(local (defchain-complex inv-ring-Z addition-ring-Z zero-element-Z inverse-Z product-ring-Z unit-Z
	 inv-D1 group-operation-D1 zero-D1 external-D1 inverse-D1 d-D1 D1
	 :hints (("Goal" :use ((:instance |HOMOTOPY-EQUIVALENCE-1-is-an-homotopy-equivalence|))))))

(local (defthm help1 (IMPLIES (AND (INV-D2 N A)
              (INV-D2 N B)
              (INV-D2 N C)
	      (integerp n))
         (EQUAL (GROUP-OPERATION-D2 N (GROUP-OPERATION-D2 N A B) C)
                (GROUP-OPERATION-D2 N A (GROUP-OPERATION-D2 N B C)))) 
:hints (("Goal" :use ((:instance |D2-is-a-chain-complex|))))))

(local (defthm help3 (IMPLIES (AND (INV-D1 N A)
              (INV-D1 N B)
              (INV-D1 N C)
	      (integerp n))
         (EQUAL (GROUP-OPERATION-D1 N (GROUP-OPERATION-D1 N A B) C)
                (GROUP-OPERATION-D1 N A (GROUP-OPERATION-D1 N B C)))) 
:hints (("Goal" :use ((:instance |D1-is-a-chain-complex|))))))



(definstance-*cone*
  ((inv-ring inv-ring-Z)
    (addition-ring addition-ring-Z)
    (product-ring product-ring-Z)
    (inverse inverse-Z)
    (zero-element zero-element-Z)
    (unit unit-Z)
    (inv-D inv-D2)
    (group-operation-D group-operation-D2)
    (zero-D zero-D2)
    (external-D external-D2)
    (inverse-D inverse-D2)
    (d-D d-D2)
    (inv-C inv-D1) 
    (group-operation-C group-operation-D1)
    (zero-C zero-D1)
    (external-C external-D1)
    (inverse-C inverse-D1)
    (d-C d-D1)    
    (phi phi-d2-d1))
  "-cone-D2-D1")

)

;;--------------------------------------------------
;; Cone from hphi: H2 -> H1
;;--------------------------------------------------


(defun phi-h2-h1 (n a)
  (rf1 n (phi-d2-d1 n (rg2 n a))))


(encapsulate 

 ()

(local (defchain-complex inv-ring-Z addition-ring-Z zero-element-Z inverse-Z product-ring-Z unit-Z
	 inv-H2 group-operation-H2 zero-H2 external-H2 inverse-H2 d-H2 H2
	 :hints (("Goal" :use ((:instance |HOMOTOPY-EQUIVALENCE-2-is-an-homotopy-equivalence|))))))

(local (defchain-complex inv-ring-Z addition-ring-Z zero-element-Z inverse-Z product-ring-Z unit-Z
	 inv-H1 group-operation-H1 zero-H1 external-H1 inverse-H1 d-H1 H1
	 :hints (("Goal" :use ((:instance |HOMOTOPY-EQUIVALENCE-1-is-an-homotopy-equivalence|))))))

(local (defthm help1 (IMPLIES (AND (INV-H2 N A)
              (INV-H2 N B)
              (INV-H2 N C)
	      (integerp n))
         (EQUAL (GROUP-OPERATION-H2 N (GROUP-OPERATION-H2 N A B) C)
                (GROUP-OPERATION-H2 N A (GROUP-OPERATION-H2 N B C)))) 
:hints (("Goal" :use ((:instance |H2-is-a-chain-complex|))))))

(local (defthm help3 (IMPLIES (AND (INV-H1 N A)
              (INV-H1 N B)
              (INV-H1 N C)
	      (integerp n))
         (EQUAL (GROUP-OPERATION-H1 N (GROUP-OPERATION-H1 N A B) C)
                (GROUP-OPERATION-H1 N A (GROUP-OPERATION-H1 N B C)))) 
:hints (("Goal" :use ((:instance |H1-is-a-chain-complex|))))))



(definstance-*cone*
  ((inv-ring inv-ring-Z)
    (addition-ring addition-ring-Z)
    (product-ring product-ring-Z)
    (inverse inverse-Z)
    (zero-element zero-element-Z)
    (unit unit-Z)
    (inv-D inv-H2)
    (group-operation-D group-operation-H2)
    (zero-D zero-H2)
    (external-D external-H2)
    (inverse-D inverse-H2)
    (d-D d-H2)
    (inv-C inv-H1) 
    (group-operation-C group-operation-H1)
    (zero-C zero-H1)
    (external-C external-H1)
    (inverse-C inverse-H1)
    (d-C d-H1)    
    (phi phi-h2-h1))
  "-cone-H2-H1")
)

;;;--------------------------------------------------
;;; Morphisms of the equivalence
;;;--------------------------------------------------

(defun lf-cones (n a)
  (list (lf1 n (car a))
	(lf2 (1- n) (cadr a))))

(defun lg-cones (n a)
  (list (lg1 n (car a))
	(lg2 (1- n) (cadr a))))

(defun lh-cones (n a)
  (list (lh1 n (car a))
	(inverse-D2 n (lh2 (1- n) (cadr a)))))

(defun rf-cones (n a)
  (list (group-operation-H1 n (rf1 n (car a))
			    (rf1 n (phi-d2-d1 n (rh2 (1- n) (cadr a)))))
	(rf2 (1- n) (cadr a))))

(defun rg-cones (n a)
  (list
   (group-operation-D1 n (rg1 n (car a))
		       (inverse-D1 n (rh1 (1- n) (phi-d2-d1 (1- n) (rg2 (1- n) (cadr a))))))
   (rg2 (1- n) (cadr a))))

(defun rh-cones (n a)
  (list
   (group-operation-D1 (1+ n) (rh1 n (car a))
		       (rh1 n (phi-d2-d1 n (rh2 (1- n) (cadr a)))))
   (inverse-D2 n (rh2 (1- n) (cadr a)))
   ))


;;;--------------------------------------------------
;;; Auxiliar Theorems
;;;--------------------------------------------------


(defchain-complex inv-ring-Z addition-ring-Z zero-element-Z inverse-Z product-ring-Z unit-Z
	 inv-cone-cone-d2-d1 group-operation-cone-cone-d2-d1 zero-cone-cone-d2-d1 external-cone-cone-d2-d1 inverse-cone-cone-d2-d1 d-cone-cone-d2-d1 cone-d2-d1
	 :hints (("Goal" :use ((:instance |CONE-D-CHI-C-is-a-chain-complex-CONE-D2-D1| )))))

(defchain-complex inv-ring-Z addition-ring-Z zero-element-Z inverse-Z product-ring-Z unit-Z
	 inv-H1 group-operation-H1 zero-H1 external-H1 inverse-H1 d-H1 H1
	 :hints (("Goal" :use ((:instance |HOMOTOPY-EQUIVALENCE-1-is-an-homotopy-equivalence|)))))



(defchain-complex inv-ring-Z addition-ring-Z zero-element-Z inverse-Z product-ring-Z unit-Z
	 inv-D2 group-operation-D2 zero-D2 external-D2 inverse-D2 d-D2 D2
	 :hints (("Goal" :use ((:instance |HOMOTOPY-EQUIVALENCE-2-is-an-homotopy-equivalence|)))))


(defthm help1 (IMPLIES (AND (INV-D2 N A)
              (INV-D2 N B)
              (INV-D2 N C)
	      (integerp n))
         (EQUAL (GROUP-OPERATION-D2 N (GROUP-OPERATION-D2 N A B) C)
                (GROUP-OPERATION-D2 N A (GROUP-OPERATION-D2 N B C)))) 
:hints (("Goal" :use ((:instance |D2-is-a-chain-complex|)))))

(defchain-complex inv-ring-Z addition-ring-Z zero-element-Z inverse-Z product-ring-Z unit-Z
	 inv-D1 group-operation-D1 zero-D1 external-D1 inverse-D1 d-D1 D1
	 :hints (("Goal" :use ((:instance |HOMOTOPY-EQUIVALENCE-1-is-an-homotopy-equivalence|)))))
 
(defthm help3 (IMPLIES (AND (INV-D1 N A)
              (INV-D1 N B)
              (INV-D1 N C)
	      (integerp n))
         (EQUAL (GROUP-OPERATION-D1 N (GROUP-OPERATION-D1 N A B) C)
                (GROUP-OPERATION-D1 N A (GROUP-OPERATION-D1 N B C)))) 
:hints (("Goal" :use ((:instance |D1-is-a-chain-complex|)))))



(in-theory (disable |D1-is-a-chain-complex|
		    |D2-is-a-chain-complex|
		    |CONE-D2-D1-is-a-chain-complex|
		    |CONE-D-CHI-C-is-a-chain-complex-CONE-D2-D1|))


(defthm inv-lf2
  (implies (and (inv-d2 (+ -1 n) (cadr a)) (integerp n))
	   (inv-c2 (+ -1 n) (lf2 (+ -1 n) (cadr a)))))

(defthm inv-phi-c2-c1
  (implies (and (inv-c2 (+ -1 n) a) (integerp n))
	   (inv-c1 (+ -1 n) (phi-c2-c1 (+ -1 n) a))))

(defthm inv-lg1
  (implies (and (inv-c1 (+ -1 n) a) (integerp n))
	   (inv-d1 (+ -1 n) (lg1 (+ -1 n) a))))

(defthm inv-lg1-phi-c2-c1-lf2
  (implies (and (inv-d2 (+ -1 n) (cadr a)) (integerp n))
	   (inv-d1 (+ -1 n) (lg1 (+ -1 n) 
				 (phi-c2-c1 (+ -1 n)
					    (lf2 (+ -1 n) (cadr a)))))))

(defthm inv-d-d1 
  (implies (and (inv-d1 n (car a)) (integerp n))
	   (inv-d1 (+ n -1) (d-d1 n (car a)))))

(defthm inv-d-d1-4
  (implies (and (inv-d1 n a) (integerp n))
	   (inv-d1 (+ n -1) (d-d1 n a))))


(in-theory (enable COMMUTATIVITY-OF-+))
		   
(defthm inv-d-d1-2 
  (implies (and (inv-d1 n (car a)) (integerp n))
	   (inv-d1 (+ -1 n) (d-d1 n (car a))))
  :hints (("Goal" :use ((:instance inv-d-d1 )))))


(defthm inv-d-d1-3
  (implies (and (inv-d1 n (car b)) (integerp n))
	   (inv-d1 (+ -1 n) (d-d1 n (car b))))
  :hints (("Goal" :use ((:instance inv-d-d1-2 )))))

(defthm inv-d-d1-5
  (implies (and (inv-d1 n a) (integerp n))
	   (inv-d1 (+ -1 n) (d-d1 n a)))
   :hints (("Goal" :use ((:instance inv-d-d1-4 )))))

(defthm inv-d-d2
  (implies (and (inv-d2 n a) (integerp n))
	   (inv-d2 (+ n -1) (d-d2 n a)))
  :hints (("Goal" :use (:instance |D2-is-a-chain-complex|))))

(defthm inv-d-d2-2
  (implies (and (inv-d2 (+ n -1)  (cadr a)) (integerp n))
	   (inv-d2 (+ (+ n -1) -1) (d-d2 (+ n -1) (cadr a))))
  :hints (("Goal" :use (:instance inv-d-d2
				  (a (cadr a))
				  (n (+ n -1))))))

(defthm +n-1-1
  (equal (+ (+ n -1) -1)
	 (+ -1 -1 n))
  :rule-classes nil)

(defthm inv-d-d2-3
  (implies (and (inv-d2 (+ -1 n)  (cadr a)) (integerp n))
	   (inv-d2 (+ -1 -1 N) (d-d2 (+ -1 n) (cadr a))))
  :hints (("Goal" :use ((:instance +n-1-1)
			(:instance inv-d-d2-2)))))



(defthm group-operation-D1-commutativity
  (implies (and (inv-d1 n a)
		(inv-d1 n b)
		(integerp n))
	   (equal (group-operation-d1 n a b)
		  (group-operation-d1 n b a)))
  )

(defthm group-operation-D1-distrivutivity
  (implies (and (inv-d1 n a)
		(inv-d1 n b)
		(inv-d1 n c)
		(integerp n))
	   (equal (group-operation-d1 n c (group-operation-d1 n a b))
		  (group-operation-d1 n a (group-operation-d1 n b c))))
  :hints (("Goal" :do-not-induct t
	   :use ((:instance |D1-is-a-chain-complex|)))))

(defthm group-operation-d1-distrivutivity-2
  (implies (and (inv-d1 n a)
		(inv-d1 n b)
		(inv-d1 n c)
		(integerp n))
	   (equal (group-operation-d1 n a (group-operation-d1 n b c))
		  (group-operation-d1 n b (group-operation-d1 n a c))))
  :hints (("Goal" :do-not-induct t
	   :use ((:instance group-operation-D1-commutativity
			    (a b) (b c))
		 (:instance group-operation-D1-distrivutivity
			    (c b) (b c))))))



(defthm group-operation-c1-commutativity
  (implies (and (inv-c1 n a)
		(inv-c1 n b)
		(integerp n))
	   (equal (group-operation-c1 n a b)
		  (group-operation-c1 n b a)))
  )

(defchain-complex inv-ring-Z addition-ring-Z zero-element-Z inverse-Z product-ring-Z unit-Z
	 inv-C1 group-operation-C1 zero-C1 external-C1 inverse-C1 d-C1 C1
	 :hints (("Goal" :use ((:instance |HOMOTOPY-EQUIVALENCE-1-is-an-homotopy-equivalence|)))))

(defthm group-operation-c1-distrivutivity
  (implies (and (inv-c1 n a)
		(inv-c1 n b)
		(inv-c1 n c)
		(integerp n))
	   (equal (group-operation-c1 n c (group-operation-c1 n a b))
		  (group-operation-c1 n a (group-operation-c1 n b c))))
  :hints (("Goal" :do-not-induct t
	   :use ((:instance |C1-is-a-chain-complex|)))))

(defthm group-operation-c1-distrivutivity-2
  (implies (and (inv-c1 n a)
		(inv-c1 n b)
		(inv-c1 n c)
		(integerp n))
	   (equal (group-operation-c1 n a (group-operation-c1 n b c))
		  (group-operation-c1 n b (group-operation-c1 n a c))))
  :hints (("Goal" :do-not-induct t
	   :use ((:instance group-operation-c1-commutativity
			    (a b) (b c))
		 (:instance group-operation-c1-distrivutivity
			    (c b) (b c))))))


(defchain-complex inv-ring-Z addition-ring-Z zero-element-Z inverse-Z product-ring-Z unit-Z
	 inv-C2 group-operation-C2 zero-C2 external-C2 inverse-C2 d-C2 C2
	 :hints (("Goal" :use ((:instance |HOMOTOPY-EQUIVALENCE-2-is-an-homotopy-equivalence|)))))


(defthm group-operation-c2-commutativity
  (implies (and (inv-c2 n a)
		(inv-c2 n b)
		(integerp n))
	   (equal (group-operation-c2 n a b)
		  (group-operation-c2 n b a)))
  )

(defthm group-operation-c2-distrivutivity
  (implies (and (inv-c2 n a)
		(inv-c2 n b)
		(inv-c2 n c)
		(integerp n))
	   (equal (group-operation-c2 n c (group-operation-c2 n a b))
		  (group-operation-c2 n a (group-operation-c2 n b c))))
  :hints (("Goal" :do-not-induct t
	   :use ((:instance |C2-is-a-chain-complex|)))))

(defthm group-operation-c2-distrivutivity-2
  (implies (and (inv-c2 n a)
		(inv-c2 n b)
		(inv-c2 n c)
		(integerp n))
	   (equal (group-operation-c2 n a (group-operation-c2 n b c))
		  (group-operation-c2 n b (group-operation-c2 n a c))))
  :hints (("Goal" :do-not-induct t
	   :use ((:instance group-operation-c2-commutativity
			    (a b) (b c))
		 (:instance group-operation-c2-distrivutivity
			    (c b) (b c))))))


(in-theory (disable |C1-is-a-chain-complex|
		    |C2-is-a-chain-complex|
		    group-operation-D1-commutativity
		    group-operation-c1-commutativity
		    group-operation-c2-commutativity))




(defthm inv-d-c1 
  (implies (and (inv-c1 n (car a)) (integerp n))
	   (inv-c1 (+ n -1) (d-c1 n (car a))))
  :hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+))))


(defthm inv-d-c1-2 
  (implies (and (inv-c1 n (car a))(integerp n))
	   (inv-c1 (+ -1 n) (d-c1 n (car a))))
  :hints (("Goal" :use ((:instance inv-d-c1 )))))


(defthm inv-d-c2
  (implies (and (inv-c2 n a) (integerp n))
	   (inv-c2 (+ n -1) (d-c2 n a)))
  :hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+))))

(defthm inv-d-c2-2
  (implies (and (inv-c2 (+ n -1)  (cadr a)) (integerp n))
	   (inv-c2 (+ (+ n -1) -1) (d-c2 (+ n -1) (cadr a))))
  :hints (("Goal" :use (:instance inv-d-c2
				  (a (cadr a))
				  (n (+ n -1))))))

(defthm inv-d-c2-3
  (implies (and (inv-c2 (+ -1 n)  (cadr a)) (integerp n))
	   (inv-c2 (+ -1 -1 N) (d-c2 (+ -1 n) (cadr a))))
  :hints (("Goal" :use ((:instance +n-1-1)
			(:instance inv-d-c2-2)))))

(defthm inv-lh1 
  (implies (and (inv-d1 n a) (integerp n))
	   (inv-d1 (+ n 1) (lh1 n a)))
  :hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+))))


(defthm inv-lh1-2
  (implies (and (inv-d1 n a) (integerp n))
	   (inv-d1 (+ 1 n) (lh1 n a)))
  :hints (("Goal" :use ((:instance inv-lh1 )))))


(defthm inv-lh2
  (implies (and (inv-d2 n a) (integerp n))
	   (inv-d2 (+ n 1) (lh2 n a)))
  :hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+))))

(defthm inv-lh2-2
  (implies (and (inv-d2 (+ -1 n) a) (integerp n))
	   (inv-d2 (+ (+ -1 n) 1) (lh2 (+ -1 n) a)))
  :hints (("Goal" :use (:instance inv-lh2
				  (n (+ -1 n))))))




(defthm +n-1+1
  (implies (integerp n)
	   (equal (+ (+ -1 n) 1) n))
  :rule-classes nil)

(defthm +n-1+1-bis
  (implies (integerp n)
	   (equal (+ -1 1 n) n))
  :rule-classes nil)

(defthm inv-lh2-3
  (implies (and (inv-d2 (+ -1 n)  (cadr a)) (integerp n))
	   (inv-d2 n (lh2 (+ -1 n) (cadr a))))
  :hints (("Goal" :use ((:instance inv-lh2-2 (a (cadr a)))
			(:instance +n-1+1)
			))))

(defthm inv-inverse-d2
  (implies (and (inv-d2 n a) (integerp n))
	   (inv-d2 n (inverse-d2 n a))))

(defthm inv-inverse-d2-2
  (implies (and (inv-d2 n a) (integerp n))
	   (inv-d2 (+ -1 1 n) (inverse-d2 n a)))
  :hints (("Goal" :use ((:instance inv-inverse-d2)
			(:instance +n-1+1-bis)
			))))

 (defthm inverse-group-operation-d2
 (implies (and (inv-d2 n a)
		   (inv-d2 n b)
		   (integerp n))
	      (equal (inverse-d2 n (group-operation-d2 n a b))
		     (group-operation-d2 n (inverse-d2 n a)
					 (inverse-d2 n b)))))

(defthm +n-1+1-bis2
  (implies (integerp n)
	   (equal (+ 1 -1 n) n))
  :rule-classes nil)

(defthm inverse-group-operation-d2-bis
 (implies (and (inv-d2 n a)
	       (inv-d2 n b)
	       (integerp n))
	      (equal (inverse-d2 n (group-operation-d2 (+ 1 -1 n) a b))
		     (group-operation-d2 (+ 1 -1 n) (inverse-d2 n a)
					 (inverse-d2 n b))))
 :hints (("Goal" :use ((:instance inverse-group-operation-d2)
			(:instance +n-1+1-bis2)
			))))

(defthm +n-1+1-bis3
  (implies (integerp n)
	   (equal (+ 1 -1 n) (+ -1 1 n)))
  :rule-classes nil)

(defthm group-operation-d2-commutativity-+1-1+n
  (implies (and (integerp n)
		(inv-d2 n a)
		(inv-d2 n b))
	   (equal (group-operation-d2 (+ 1 -1 n) a b)
		  (group-operation-d2 (+ -1 1 n) a b)))
  :hints (("Goal" :use ((:instance +n-1+1-bis3)))))

(defthm inverse-group-operation-d2-bis2
 (implies (and (inv-d2 n a)
	       (inv-d2 n b)
	       (integerp n))
	      (equal (inverse-d2 n (group-operation-d2 (+ -1 1 n) a b))
		     (group-operation-d2 (+ -1 1 n) (inverse-d2 n a)
					 (inverse-d2 n b))))
 :hints (("Goal" :use ((:instance inverse-group-operation-d2-bis)
			(:instance +n-1+1-bis3)
			))))


(defthm inverse-external-d2
 (implies (and (inv-d2 n a)
	       (inv-ring-z r)
	       (integerp n)
	       )
	      (equal (inverse-d2 n (external-d2 n r a))
		     (external-d2 n r (inverse-d2 n a)))))


(defthm inverse-external-d2-bis
 (implies (and (inv-d2 n a)
	       (inv-ring-z r)
	       (integerp n))
	      (equal (inverse-d2 n (external-d2 (+ 1 -1 n) r a))
		     (external-d2 (+ 1 -1 n) r (inverse-d2 n a))
		     ))
 :hints (("Goal" :use ((:instance inverse-external-d2)
			(:instance +n-1+1-bis2)
			))))



(defthm external-d2-commutativity-+1-1+n
  (implies (and (integerp n)
		(inv-ring-z r)
		(inv-d2 n a)
		)
	   (equal (external-d2 (+ 1 -1 n) r a)
		  (external-d2 (+ -1 1 n) r a)))
  :hints (("Goal" :use ((:instance +n-1+1-bis3)))))

(defthm inverse-external-d2-bis2
  (implies (and (inv-d2 n a)
	       (inv-ring-z r)
	       (integerp n))
	      (equal (inverse-d2 n (external-d2 (+ -1 1 n) r a))
		     (external-d2 (+ -1 1 n) r (inverse-d2 n a))
		     ))
 :hints (("Goal" :use ((:instance inverse-external-d2-bis)
			(:instance +n-1+1-bis3)
			))))

(defthm inverse-d2-zero
  (implies (integerp n)
	   (equal (inverse-d2 n (zero-d2 n))
		  (zero-d2 n))))

(defthm inverse-d2-zero-bis
  (implies (integerp n)
	   (equal (inverse-d2 n (zero-d2 (+ 1 -1 N)))
		  (zero-d2 (+ 1 -1 N))))
  :hints (("Goal" :use ((:instance inverse-d2-zero)
			(:instance +n-1+1-bis2)
			))))

(defthm inverse-d2-zero-bis2
  (implies (integerp n)
	   (equal (inverse-d2 n (zero-d2 (+ 1 -1 N)))
		  (zero-d2 (+ -1 1 N))))
  :hints (("Goal" :use ((:instance inverse-d2-zero-bis)
			(:instance +n-1+1-bis3)
			))))

(defthm inverse-inverse-d2
 (implies (and (inv-d2 n a)
	       (integerp n))
	      (equal (inverse-d2 n (inverse-d2 (+ 1 -1 n) a))
		     (inverse-d2 (+ 1 -1 n) (inverse-d2 n a))
		     ))
 :hints (("Goal" :use ((:instance +n-1+1-bis2)
			))))




(defthm inverse-inverse-d2-bis
  (implies (and (inv-d2 n a)
	       (integerp n))
	      (equal (inverse-d2 n (inverse-d2 (+ 1 -1 n) a))
		     (inverse-d2 (+ -1 1 n) (inverse-d2 n a))
		     ))
 :hints (("Goal" :use ((:instance inverse-inverse-d2)
			(:instance +n-1+1-bis3)
			))))



(encapsulate 
 ()

 (local (defthm group-operation-zero-d1
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (equal (group-operation-d1 n
				       (zero-d1 n)
				       gnrt)
		  gnrt)))
)

(local(defthm inverse-d2-lh2
  (implies (and (inv-d2 n a)
		(integerp n))
	   (equal (inverse-d2 (+ n 1) (lh2 n a))
		  (lh2 n (inverse-d2 n a))))))

(local(defthm inverse-d2-lh2-bis
  (implies (and (inv-d2 (+ -1 n) a)
		(integerp n))
	   (equal (inverse-d2 n (lh2 (+ -1 n) a))
		  (lh2 (+ -1 n) (inverse-d2 (+ -1 n) a))))
  :hints (("Goal" :use ((:instance inverse-d2-lh2 (n (+ -1 n)))
			(:instance  +n-1+1-bis3)
			(:instance  +n-1+1-bis2))))))





(local(defthm lf2-lh2
  (implies (and (inv-d2 n  gnrt) (integerp n))
	   (equal (lf2 (+ 1 n) (lh2 n gnrt))
		  (zero-c2 (+ 1 n))))
  ))

(local(defthm lg1-phi-c2-c1-lf2-inverse-lh2-aux1
  (implies (and (inv-d2 (+ -1 n) a)
		(integerp n))
	   (equal(LF2 (+ 1 -1 N)
                                 (INVERSE-D2 (+ 1 -1 N)
                                             (LH2 (+ -1 N) a))) 
		 (zero-c2 (+ 1 -1 N))))
  :hints (("Goal" :USE ((:INSTANCE inverse-d2-lh2-bis)
			(:INSTANCE lf2-lh2 (GNRT (inverse-d2 (+ -1 n) a))
				   (N (+ -1 N)))
			)))))


(local(defthm inverse-d2-lh2-bis
  (implies (and (inv-d2 (+ -1 n) a)
		(integerp n))
	   (equal (inverse-d2 n (lh2 (+ -1 n) a))
		  (lh2 (+ -1 n) (inverse-d2 (+ -1 n) a))))
  :hints (("Goal" :use ((:instance inverse-d2-lh2 (n (+ -1 n)))
			(:instance  +n-1+1-bis3)
			(:instance  +n-1+1-bis2))))))





(local(defthm lf2-lh2
  (implies (and (inv-d2 n  gnrt) (integerp n))
	   (equal (lf2 (+ 1 n) (lh2 n gnrt))
		  (zero-c2 (+ 1 n))))
  ))

(local(defthm lg1-phi-c2-c1-lf2-inverse-lh2-aux1
  (implies (and (inv-d2 (+ -1 n) a)
		(integerp n))
	   (equal(LF2 (+ 1 -1 N)
                                 (INVERSE-D2 (+ 1 -1 N)
                                             (LH2 (+ -1 N) a))) 
		 (zero-c2 (+ 1 -1 N))))
  :hints (("Goal" :USE ((:INSTANCE inverse-d2-lh2-bis)
			(:INSTANCE lf2-lh2 (GNRT (inverse-d2 (+ -1 n) a))
				   (N (+ -1 N)))
			)))))


(local( defthm lg1-phi-c2-c1-lf2-inverse-lh2-aux2
  (implies (and (inv-d2 (+ -1 n) a)
		(integerp n))
	   (equal(LF2 (+ -1 1 n)
                                 (INVERSE-D2 (+ 1 -1 N)
                                             (LH2 (+ -1 N) a))) 
		 (zero-c2 (+ 1 -1 N))))
  :hints (("Goal" :USE ((:INSTANCE lg1-phi-c2-c1-lf2-inverse-lh2-aux1)
			(:instance  +n-1+1-bis3)
			)))))


(local(defthm aux1 (implies (integerp n)     
      (equal (LG1 (+ 1 -1 N)
	   (PHI-C2-C1 (+ 1 -1 N)
		      (ZERO-C2 (+ 1 -1 N))))
	     (ZERO-d1 (+ 1 -1 N))))))

(local (defthm aux2 (implies (integerp n)     
      (equal (LG1 (+ -1 1 N)
	   (PHI-C2-C1 (+ -1 1 N)
		      (ZERO-C2 (+ 1 -1 N))))
	     (ZERO-d1 (+ -1 1 N))))
  :hints (("Goal" :USE ((:INSTANCE aux1)
			(:instance  +n-1+1-bis3)
			)))))

(local(defthm inverse-inverse-d2-equal
  (implies (and (inv-d2 n a)
		(integerp n))
	   (equal (inverse-d2 n (inverse-d2 n a))
		  a))))

(local(defthm inverse-inverse-lh2-d-d2-aux
  (implies (and (inv-d2 n a) (integerp n))
	   (equal (INVERSE-D2 (+ (+ N -1) 1)
		       (INVERSE-D2 (+ (+ N -1) 1)
				   (LH2 (+ N -1)
					(D-D2 n a))))
		  (LH2 (+ N -1)
		       (D-D2 n a))))
  :hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+)
	   :use ((:instance inv-d-d2)
		 (:instance inv-lh2 (n (+ n -1))
			    (a (D-D2 n a)))
		 (:instance INVERSE-INVERSE-D2-equal
			    (n (+ 1 (+ N -1)))
			    (a (LH2 (+ N -1)
				    (D-D2 n a)))
			    ))))))

(local(defthm inverse-inverse-lh2-d-d2-aux2
  (implies (and (inv-d2 (+ -1 N) a) (integerp n))
	   (equal (INVERSE-D2 (+ (+ (+ -1 N) -1) 1)
		       (INVERSE-D2 (+ (+ (+ -1 N) -1) 1)
				   (LH2 (+ (+ -1 N) -1)
					(D-D2 (+ -1 N) a))))
		  (LH2 (+ (+ -1 N) -1)
		       (D-D2 (+ -1 N) a))))
  :hints (("Goal" :use ((:instance inverse-inverse-lh2-d-d2-aux
				   (n (+ -1 N))				   
				   ))))))

(local(defthm +++-1n-11
  (equal (+ (+ (+ -1 N) -1) 1)
	 (+ -1 N))
  :rule-classes nil))

(local(defthm +++-1n-11-2
  (equal (+ (+ (+ -1 N) -1) 1)
	 (+ 1 -1 -1 N))
  :rule-classes nil))

(local(defthm +++-1n-11-3
  (equal (+ (+ -1 N) -1)
	 (+ -1 -1 N))
  :rule-classes nil)
)

(local (defthm inverse-inverse-lh2-d-d2
  (implies (and (inv-d2 (+ -1 N) a) (integerp n))
	   (equal (INVERSE-D2 (+ -1 N)
		       (INVERSE-D2 (+ 1 -1 -1 N)
				   (LH2 (+ -1 -1 N)
					(D-D2 (+ -1 N) a))))
		  (LH2 (+ -1 -1 N)
		       (D-D2 (+ -1 N) a))))
  :hints (("Goal" :use ((:instance inverse-inverse-lh2-d-d2-aux2)
			(:instance +++-1n-11)
			(:instance +++-1n-11-2)
			(:instance +++-1n-11-3)
				   )))))


(local(defthm d-d2-inverse-d2
  (implies (and (inv-d2 n a)
		(integerp n))
	   (equal (d-d2 n (inverse-d2 n a))
		  (inverse-d2 (+ n -1) (d-d2 n a))))))
	   


(local(defthm inverse-inverse-lh2-d-d2-2-aux1
  (implies (and (inv-d2 n a) (integerp n))
	   (equal (INVERSE-D2 (+ (+ 1 N) -1)
                          (D-D2 (+ N 1)
                                (INVERSE-D2 (+ N 1)
                                            (LH2 n a))))
		  (INVERSE-D2 (+ (+ 1 N) -1)
			      (INVERSE-D2 (+ (+ N 1) -1)
					    (d-d2 (+ N 1)
                                            (LH2 n a)))
                          )))
  :hints (("Goal" :use ((:instance inv-lh2)
			(:instance d-d2-inverse-d2 (n (+ N 1))
				   (a (LH2 n a)))
					
				   )))))

(local(defthm inverse-inverse-lh2-d-d2-2-aux2
  (implies (and (inv-d2 (+ -1 N) a) (integerp n))
	   (equal (INVERSE-D2 (+ (+ 1 (+ -1 N)) -1)
                          (D-D2 (+ (+ -1 N) 1)
                                (INVERSE-D2 (+ (+ -1 N) 1)
                                            (LH2 (+ -1 N) a))))
		  (INVERSE-D2 (+ (+ 1 (+ -1 N)) -1)
			      (INVERSE-D2 (+ (+ (+ -1 N) 1) -1)
					    (d-d2 (+ (+ -1 N) 1)
                                            (LH2 (+ -1 N) a)))
                          )))
  :hints (("Goal" :use ((:instance inverse-inverse-lh2-d-d2-2-aux1
				   (n (+ -1 N)))	
				   )))))


(local(defthm +++-1n-11-4
  (equal (+ (+ 1 (+ -1 N)) -1)
	 (+ -1 N))
  :rule-classes nil))

(local(defthm inverse-inverse-lh2-d-d2-2-aux3
  (implies (and (inv-d2 (+ -1 N) a) (integerp n))
	   (equal (INVERSE-D2 (+ (+ 1 (+ -1 N)) -1)
                          (D-D2 (+ (+ -1 N) 1)
                                (INVERSE-D2 (+ (+ -1 N) 1)
                                            (LH2 (+ -1 N) a))))
		  (INVERSE-D2 (+ -1 N)
			      (INVERSE-D2 (+ -1 N)
					    (d-d2 (+ (+ -1 N) 1)
                                            (LH2 (+ -1 N) a)))
			      
                          )))
  :hints (("Goal" :use ((:instance inverse-inverse-lh2-d-d2-2-aux2
				   )
			(:instance +++-1n-11-4))))))

(local(defthm +++-1n-11-5
  (equal (+ (+ (+ -1 N) 1) -1)
	 (+ -1 N))
  :rule-classes nil))

(local(defthm inverse-inverse-lh2-d-d2-2-aux4
  (implies (and (inv-d2 (+ -1 N) a) (integerp n))
	   (equal (INVERSE-D2 (+ (+ 1 (+ -1 N)) -1)
                          (D-D2 (+ (+ -1 N) 1)
                                (INVERSE-D2 (+ (+ -1 N) 1)
                                            (LH2 (+ -1 N) a))))
		  (d-d2 (+ (+ -1 N) 1)
			(LH2 (+ -1 N) a))))
  :hints (("Goal" :use ((:instance inv-lh2 (n (+ -1 N)))
			(:instance inv-d-d2 (n (+ (+ -1 N) 1))
				   (a (LH2 (+ -1 N) a)))
			(:instance +++-1n-11-5)
			(:instance inverse-inverse-lh2-d-d2-2-aux3)
			(:instance  d-d2-inverse-d2
				   (n (+ -1 N))
				   (a (d-d2 (+ (+ -1 N) 1)
					    (LH2 (+ -1 N) a))))
				   )))))


(local(defthm +++-1n-11-6
  (equal (+ (+ 1 (+ -1 N)) -1) 
	 (+ -1 -1 1 N))
  :rule-classes nil))

(local(defthm +++-1n-11-7
  (equal (+ (+ -1 N) 1)
	 (+ -1 1 N))
  :rule-classes nil))

(local(defthm +++-1n-11-8
  (equal (+ (+ -1 N) 1)
	 (+ 1 -1 N))
  :rule-classes nil))

(local (defthm inverse-inverse-lh2-d-d2-2
  (implies (and (inv-d2 (+ -1 N) a) (integerp n))
	   (equal (INVERSE-D2 (+ -1 -1 1 N)
                          (D-D2 (+ -1 1 N)
                                (INVERSE-D2 (+ 1 -1 N)
                                            (LH2 (+ -1 N) a))))
		  (d-d2 (+ -1 1 N)
		       (lh2 (+ -1 N) a))))
  :hints (("Goal" :use ((:instance inverse-inverse-lh2-d-d2-2-aux4)
			(:instance +++-1n-11-6)
			(:instance +++-1n-11-7)
			(:instance +++-1n-11-8)
				   )))))


(local(defthm lh2dd2-dd2-lh2
  (implies (and (inv-d2 n a)
		(integerp n))
	   (equal (group-operation-d2 n (lh2 (+ n -1) (d-d2 n a))
				      (d-d2 (+ n 1) (lh2 n a)))
		  (group-operation-d2 n a 
				      (inverse-d2 n (lg2 n (lf2 n a)))))))
)

(local(defthm lh2dd2-dd2-lh2-aux
  (implies (and (inv-d2 (+ -1 N) a)
		(integerp n))
	   (equal (group-operation-d2 (+ -1 N) (lh2 (+ (+ -1 N) -1) (d-d2 (+ -1 N) a))
				      (d-d2 (+ (+ -1 N) 1) (lh2 (+ -1 N) a)))
		  (group-operation-d2 (+ -1 N) a 
				      (inverse-d2 (+ -1 N) (lg2 (+ -1 N) (lf2 (+ -1 N) a))))))
  :hints (("Goal" :use ((:instance lh2dd2-dd2-lh2 (n (+ -1 N)))))))
)

(local (defthm lh2dd2-dd2-lh2-aux2
  (implies (and (inv-d2 (+ -1 N) a)
		(integerp n))
	   (equal (group-operation-d2 (+ -1 N) (lh2 (+ -1 -1 n) (d-d2 (+ -1 N) a))
				      (d-d2 (+ -1 1 n)(lh2 (+ -1 N) a)))
		  (group-operation-d2 (+ -1 N) a 
				      (inverse-d2 (+ -1 N) (lg2 (+ -1 N) (lf2 (+ -1 N) a))))))
  :hints (("Goal" :use ((:instance lh2dd2-dd2-lh2-aux)
			(:instance +++-1n-11-3))))))

(DEFTHM
  AUX
              (IMPLIES (AND (EQUAL (LIST (CAR GNRT) (CADR GNRT))
                                   GNRT)
                            (INV-D1 N (CAR GNRT))
                            (INV-D2 (+ -1 N) (CADR GNRT))
                            (INTEGERP N))
                       (EQUAL (GROUP-OPERATION-CONE-CONE-D2-D1
                                   N
                                   (LH-CONES (+ -1 N)
                                             (D-CONE-CONE-D2-D1 N GNRT))
                                   (D-CONE-CONE-D2-D1 (+ 1 N)
                                                      (LH-CONES N GNRT)))
                              (GROUP-OPERATION-CONE-CONE-D2-D1
                                   N GNRT
                                   (INVERSE-CONE-CONE-D2-D1
                                        N (LG-CONES N (LF-CONES N GNRT)))))))
(DEFTHM AUX-BIS
(IMPLIES
 (AND (EQUAL (LIST (CAR GNRT) (CADR GNRT))
             GNRT)
      (INV-D1 N (CAR GNRT))
      (INV-D2 (+ -1 N) (CADR GNRT))
      (INTEGERP N))
 (EQUAL
      (GROUP-OPERATION-CONE-CONE-D2-D1 N
                                       (LH-CONES (+ -1 N)
                                                 (D-CONE-CONE-D2-D1 N GNRT))
                                       (D-CONE-CONE-D2-D1 (+ 1 N)
                                                          (LH-CONES N GNRT)))
      (GROUP-OPERATION-CONE-CONE-D2-D1
           N GNRT
           (INVERSE-CONE-CONE-D2-D1 N (LG-CONES N (LF-CONES N GNRT)))))))
)



(defthm inverse-lh2
  (implies (and (inv-d2 n a)
		(integerp n))
	      (equal (inverse-d2 (+ n 1) (lh2 n a))
		     (lh2 n (inverse-d2 n a)))))

(defthm lf2-lh2
  (implies (and (inv-d2 n a)
		(integerp n))
	   (equal (lf2 (+ n 1) (lh2 n a))
		  (zero-c2 (+ n 1)))))
  
(defthm lf2-lh2-bis
  (implies (and (inv-d2 n a)
		(integerp n))
	   (equal (lf2 (+ n 1) (lh2 n (inverse-d2 n a)))
		  (zero-c2 (+ n 1))))
  :hints (("Goal" :use ((:instance lf2-lh2 (a (inverse-d2 n a)))))))


(defthm lf2-lh2-bis2
  (implies (and (inv-d2 n a)
		(integerp n))
	   (equal (lf2 (+ n 1) (inverse-d2 (+ n 1) (lh2 n a)))
		  (zero-c2 (+ n 1))))
  :hints (("Goal" :use ((:instance lf2-lh2-bis)
			(:instance inverse-lh2)))))



(defthm lf2-lh2-bis3
  (implies (and (inv-d2 (+ -1 N) a)
		(integerp n))
	   (equal (lf2 (+ (+ -1 N) 1) (inverse-d2 (+ (+ -1 N) 1) (lh2 (+ -1 N) a)))
		  (zero-c2 (+ (+ -1 N) 1))))
  :hints (("Goal" :use ((:instance lf2-lh2-bis2 (n (+ -1 N)))
			))))


(defthm +-1-n-1
  (equal (+ (+ -1 N) 1)
	 (+ -1 1 N))
  :rule-classes nil)

(defthm +-1-n-1-2
  (implies (integerp n)
	   (equal (+ (+ -1 N) 1)
		  n))
  :rule-classes nil)


(defthm lf2-lh2-bis4
  (implies (and (inv-d2 (+ -1 N) a)
		(integerp n))
	   (equal (lf2 (+ -1 1 N) (inverse-d2 n (lh2 (+ -1 N) a)))
		  (zero-c2 (+ -1 1 N))))
  :hints (("Goal" :use ((:instance lf2-lh2-bis3 )
			(:instance +-1-n-1)
			(:instance +-1-n-1-2)
			))))



(defthm lh2-lh2
  (implies (and (inv-d2 n a)
		(integerp n))
	   (equal (lh2 (+ n 1) (lh2 n a))
		  (zero-d2 (+ (+ n 1) 1))))
  :hints (("Goal" :in-theory (disable ASSOCIATIVITY-OF-+))))
  
(defthm lh2-lh2-bis
  (implies (and (inv-d2 n a)
		(integerp n))
	   (equal (lh2 (+ n 1) (lh2 n (inverse-d2 n a)))
		  (zero-d2 (+ (+ n 1) 1))))
  :hints (("Goal" :in-theory (disable ASSOCIATIVITY-OF-+)
	   :use ((:instance lh2-lh2 (a (inverse-d2 n a)))))))


(defthm lh2-lh2-bis2
  (implies (and (inv-d2 n a)
		(integerp n))
	   (equal (lh2 (+ n 1) (inverse-d2 (+ n 1) (lh2 n a)))
		  (zero-d2 (+ (+ n 1) 1))))
  :hints (("Goal" :in-theory (disable ASSOCIATIVITY-OF-+)
	   :use ((:instance lh2-lh2-bis)
			(:instance inverse-lh2)))))



(defthm lh2-lh2-bis3
  (implies (and (inv-d2 (+ -1 N) a)
		(integerp n))
	   (equal (lh2 (+ (+ -1 N) 1) (inverse-d2 (+ (+ -1 N) 1) (lh2 (+ -1 N) a)))
		  (zero-d2 (+ (+ (+ -1 N) 1) 1))))
  :hints (("Goal" :use ((:instance lh2-lh2-bis2 (n (+ -1 N)))
			))))


(DEFTHM +-1-N-1-3
  (IMPLIES (INTEGERP N)
	   (EQUAL (+ (+ (+ -1 N) 1) 1) (+ -1 1 1 N)))
  :RULE-CLASSES NIL)

(defthm lh2-lh2-bis4
  (implies (and (inv-d2 (+ -1 N) a)
		(integerp n))
	   (equal (lh2 (+ -1 1 N) (inverse-d2 n (lh2 (+ -1 N) a)))
		  (zero-d2 (+ (+ (+ -1 N) 1) 1))))
  :hints (("Goal" :use ((:instance lh2-lh2-bis3)
			(:instance +-1-n-1)
			(:instance +-1-n-1-2)
			(:instance +-1-n-1-3)
			))))


(DEFTHM +-1-N-1-4
  (IMPLIES (INTEGERP N)
	   (EQUAL (+ 1 1 -1 N) (+ 1 N)))
  :RULE-CLASSES NIL)

(DEFTHM +-1-N-1-5
  (IMPLIES (INTEGERP N)
	   (EQUAL (+ 1 1 -1 N) (+ -1 1 1 N)))
  :RULE-CLASSES NIL)

(defthm inverse-d2-zero-bis3
  (implies (integerp n)
	   (equal (inverse-d2 (+ 1 N) (zero-d2 (+ 1 1 -1 N)))
		  (zero-d2 (+ -1 1 1 N))))
  :hints (("Goal" :use ((:instance inverse-d2-zero (n (+ 1 N)))
			(:instance +-1-n-1-4)
			(:instance +-1-n-1-5)
			))))


(encapsulate 

 ()

(local (defthm H1-help3 (IMPLIES (AND (INV-H1 N A)
              (INV-H1 N B)
              (INV-H1 N C)
	      (integerp n))
         (EQUAL (GROUP-OPERATION-H1 N (GROUP-OPERATION-H1 N A B) C)
                (GROUP-OPERATION-H1 N A (GROUP-OPERATION-H1 N B C)))) 
:hints (("Goal" :use ((:instance |H1-is-a-chain-complex|))))))


(defthm group-operation-H1-commutativity
  (implies (and (inv-h1 n a)
		(inv-h1 n b)
		(integerp n))
	   (equal (group-operation-h1 n a b)
		  (group-operation-h1 n b a)))
  )

(defthm group-operation-H1-distrivutivity
  (implies (and (inv-h1 n a)
		(inv-h1 n b)
		(inv-h1 n c)
		(integerp n))
	   (equal (group-operation-h1 n c (group-operation-h1 n a b))
		  (group-operation-h1 n a (group-operation-h1 n b c))))
  :hints (("Goal" :do-not-induct t
	   :use ((:instance |H1-is-a-chain-complex|)))))

(defthm group-operation-h1-distrivutivity-2
  (implies (and (inv-h1 n a)
		(inv-h1 n b)
		(inv-h1 n c)
		(integerp n))
	   (equal (group-operation-h1 n a (group-operation-h1 n b c))
		  (group-operation-h1 n b (group-operation-h1 n a c))))
  :hints (("Goal" :do-not-induct t
	   :use ((:instance group-operation-H1-commutativity
			    (a b) (b c))
		 (:instance group-operation-H1-distrivutivity
			    (c b) (b c))))))



(defthm group-operation-H2-commutativity
  (implies (and (inv-h2 n a)
		(inv-h2 n b)
		(integerp n))
	   (equal (group-operation-h2 n a b)
		  (group-operation-h2 n b a)))
  )

(defchain-complex inv-ring-Z addition-ring-Z zero-element-Z inverse-Z product-ring-Z unit-Z
	 inv-H2 group-operation-H2 zero-H2 external-H2 inverse-H2 d-H2 H2
	 :hints (("Goal" :use ((:instance |HOMOTOPY-EQUIVALENCE-2-is-an-homotopy-equivalence|)))))

(defthm group-operation-H2-distrivutivity
  (implies (and (inv-h2 n a)
		(inv-h2 n b)
		(inv-h2 n c)
		(integerp n))
	   (equal (group-operation-h2 n c (group-operation-h2 n a b))
		  (group-operation-h2 n a (group-operation-h2 n b c))))
  :hints (("Goal" :do-not-induct t
	   :use ((:instance |H2-is-a-chain-complex|)))))

(defthm group-operation-h2-distrivutivity-2
  (implies (and (inv-h2 n a)
		(inv-h2 n b)
		(inv-h2 n c)
		(integerp n))
	   (equal (group-operation-h2 n a (group-operation-h2 n b c))
		  (group-operation-h2 n b (group-operation-h2 n a c))))
  :hints (("Goal" :do-not-induct t
	   :use ((:instance group-operation-H2-commutativity
			    (a b) (b c))
		 (:instance group-operation-H2-distrivutivity
			    (c b) (b c))))))
)


(defthm inv-lf2
  (implies (and (inv-d2 (+ -1 n) (cadr a)) (integerp n))
	   (inv-c2 (+ -1 n) (lf2 (+ -1 n) (cadr a)))))

(defthm inv-rg2
  (implies (and (inv-h2 (+ -1 n) (cadr a)) (integerp n))
	   (inv-d2 (+ -1 n) (rg2 (+ -1 n) (cadr a)))))

(defthm inv-phi-c2-c1
  (implies (and (inv-c2 (+ -1 n) a) (integerp n))
	   (inv-c1 (+ -1 n) (phi-c2-c1 (+ -1 n) a))))

(defthm inv-lg1
  (implies (and (inv-c1 (+ -1 n) a) (integerp n))
	   (inv-d1 (+ -1 n) (lg1 (+ -1 n) a))))

(defthm inv-rf1
  (implies (and (inv-d1 (+ -1 n) a) (integerp n))
	   (inv-h1 (+ -1 n) (rf1 (+ -1 n) a))))

(defthm inv-rf1-lg1-phi-c2-c1-lf2
  (implies (and (inv-h2 (+ -1 n) (cadr a)) (integerp n))
	   (inv-h1 (+ -1 n) (rf1 (+ -1 n) (lg1 (+ -1 n) 
				 (phi-c2-c1 (+ -1 n)
					    (lf2 (+ -1 n) (rg2 (+ -1 n)(cadr a))))))))
  )


(defthm inv-d-h1
  (implies (and (inv-h1 n (car a))
		(integerp n))
	   (inv-h1 (+ n -1) (d-h1 n (car a))))
  :hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+))))

(defthm inv-d-h1-2
  (implies (and (inv-h1 n (car a))
		(integerp n))
	   (inv-h1 (+ -1 n) (d-h1 n (car a))))
  :hints (("Goal" :use (:instance inv-d-h1))))



(defthm inv-d-h2
  (implies (and (inv-h2 n (cadr a))
		(integerp n))
	   (inv-h2 (+ n -1) (d-h2 n (cadr a))))
  :hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+))))

(defthm inv-d-h2-2
  (implies (and (inv-h2 (+ -1 N) (cadr a))
		(integerp n))
	   (inv-h2 (+ (+ -1 N) -1) (d-h2 (+ -1 N) (cadr a))))
  :hints (("Goal" :use (:instance inv-d-h2 (n (+ -1 N))))))


(defthm ++-1+n-1
  (equal (+ (+ -1 N) -1)
	 (+ -1 -1 N))
  :rule-classes nil)
	 

(defthm inv-d-h2-3
  (implies (and (inv-h2 (+ -1 N) (cadr a))
		(integerp n))
	   (inv-h2 (+ -1 -1 N) (d-h2 (+ -1 N) (cadr a))))
  :hints (("Goal" :in-theory (disable ASSOCIATIVITY-OF-+
				      COMMUTATIVITY-OF-+)
	   :use ((:instance inv-d-h2)
			(:instance ++-1+n-1)
	   ))))




(DEFTHM inv-rh2  
  (IMPLIES (AND (INV-d2 N A) (INTEGERP N))
	   (INV-D2 (+ N 1) (rh2 N A)))
  :HINTS (("Goal" :IN-THEORY (DISABLE COMMUTATIVITY-OF-+))))

(defthm +-1+n
  (implies (integerp n)
	   (equal (+ (+ -1 n) 1)
		  n))
  :rule-classes nil)

(defthm inv-rh2-2
  (implies (and (inv-d2 (+ -1 n) a) (integerp n))
	   (inv-d2 n (rh2 (+ -1 n) a)))
  :hints (("Goal"  :use ((:instance inv-rh2 (n (+ -1 n)))
		 (:instance +-1+n)))))


(defthm external-d2-external-h1
(implies (and (integerp n)
	      (inv-d2 n a)
	      (inv-ring-z r))
(equal (RF1 (+ n 1)
            (LG1 (+ n 1)
                 (PHI-C2-C1 (+ n 1)
                            (LF2 (+ n 1)
                                 (EXTERNAL-D2 (+ n 1)
                                              R (RH2 n a))))))
       (EXTERNAL-H1 (+ n 1) R
                 (RF1 (+ n 1)
                      (LG1 (+ n 1)
                           (PHI-C2-C1 (+ n 1)
                                      (LF2 (+ n 1) (RH2 n a)))))))
)
:hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+))))

(defthm ++-1+n-1-2
  (implies (integerp n)
	   (equal (+ (+ -1 N) 1)
		  n))
	   :rule-classes nil)

(defthm ++-1+n-1-3
  (implies (integerp n)
	   (equal (+ -1 1 N)
		  n))
	   :rule-classes nil)

(defthm external-d2-external-h1-bis
(implies (and (integerp n)
	      (inv-d2 (+ -1 N) a)
	      (inv-ring-z r))
(equal (RF1 n
            (LG1 n
                 (PHI-C2-C1 n
                            (LF2 n
                                 (EXTERNAL-D2 (+ -1 1 N)
                                              R (RH2 (+ -1 N) a))))))
       (EXTERNAL-H1 n R
                 (RF1 n
                      (LG1 n
                           (PHI-C2-C1 n
                                      (LF2 n (RH2 (+ -1 N) a)))))))
)
:hints (("Goal" :use ((:instance external-d2-external-h1 (n (+ -1 N)))
		      (:instance ++-1+n-1-2)
		      (:instance ++-1+n-1-3)))))


(defthm zero-d2-zero-h1
  (implies (integerp n)
	   (equal (RF1 N
		       (LG1 N
			    (PHI-C2-C1 N (LF2 N (ZERO-D2 n)))))
		  (ZERO-H1 N))))

(defthm ++-1+n-1-4
  (implies (integerp n)
	   (equal (+ 1 -1 N)
		  n))
	   :rule-classes nil)

(defthm zero-d2-zero-h1-bis
  (implies (integerp n)
	   (equal (RF1 N
		       (LG1 N
			    (PHI-C2-C1 N (LF2 N (ZERO-D2 (+ 1 -1 N))))))
		  (ZERO-H1 N)))
  :hints (("Goal" :use ((:instance zero-d2-zero-h1)
		       (:instance ++-1+n-1-4)))))

(defthm inverse-d2-inverse-h1
(implies (and (integerp n)
	      (inv-d2 n a)
	      )
(equal (RF1 (+ n 1)
            (LG1 (+ n 1)
                 (PHI-C2-C1 (+ n 1)
                            (LF2 (+ n 1)
                                 (inverse-D2 (+ n 1)
                                               (RH2 n a))))))
       (inverse-H1 (+ n 1) 
                 (RF1 (+ n 1)
                      (LG1 (+ n 1)
                           (PHI-C2-C1 (+ n 1)
                                      (LF2 (+ n 1) (RH2 n a)))))))
)
:hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+))))

(defthm inverse-d2-inverse-h1-bis
(implies (and (integerp n)
	      (inv-d2 (+ -1 N) a)
	      )
(equal (RF1 n
            (LG1 n
                 (PHI-C2-C1 n
                            (LF2 n
                                 (inverse-D2 (+ 1 -1 N)
                                              (RH2 (+ -1 N) a))))))
       (inverse-H1 n 
                 (RF1 n
                      (LG1 n
                           (PHI-C2-C1 n
                                      (LF2 n (RH2 (+ -1 N) a)))))))
)
:hints (("Goal" :use ((:instance inverse-d2-inverse-h1 (n (+ -1 N)))
		      (:instance ++-1+n-1-2)
		      (:instance ++-1+n-1-4)))))


(defthm lemma-aux-1
  (implies (and (inv-d2 n a)
		(inv-d2 n b)
		(integerp n))
	   (equal (RF1 (+ n 1)
             (LG1 (+ n 1)
                  (PHI-C2-C1 (+ n 1)
                             (LF2 (+ n 1)
                                  (GROUP-OPERATION-D2 (+ n 1)
                                                      (RH2 n A)
                                                      (RH2 n B))))))
		  (GROUP-OPERATION-H1
                  (+ n 1)
                  (RF1 (+ n 1)
                       (LG1 (+ n 1)
                            (PHI-C2-C1 (+ n 1) (LF2 (+ n 1) (RH2 n A)))))
                  (RF1 (+ n 1)
                       (LG1 (+ n 1)
                            (PHI-C2-C1 (+ n 1) (LF2 (+ n 1) (RH2 n B))))))
		  
))
:hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+))))


(defthm lemma-aux-2
  (implies (and (inv-d2 (+ -1 N) a)
		(inv-d2 (+ -1 N) b)
		(integerp n))
	   (equal (RF1 n
             (LG1 n
                  (PHI-C2-C1 n
                             (LF2 n
                                  (GROUP-OPERATION-D2 (+ -1 1 N)
                                                      (RH2 (+ -1 N) A)
                                                      (RH2 (+ -1 N) B))))))
		  (GROUP-OPERATION-H1
                  n
                  (RF1 n
                       (LG1 n
                            (PHI-C2-C1 n (LF2 n (RH2 (+ -1 N) A)))))
                  (RF1 n
                       (LG1 n
                            (PHI-C2-C1 n (LF2 n (RH2 (+ -1 N)  B))))))
		  
))
:hints (("Goal" :use ((:instance lemma-aux-1 (n (+ -1 N)))
		      (:instance ++-1+n-1-2)
		      (:instance ++-1+n-1-3)))))

(defthm inv-rh1-lg1-phi-c2-c1-lf2-rh2
  (implies (and (inv-d2 n (cadr a)) (integerp n))
	   (inv-d1 (+ (+ n 1) 1)
		   (rh1 (+ n 1)
			(lg1 (+ n 1) 
			     (phi-c2-c1 (+ n 1)
					(lf2 (+ n 1) (rh2 n(cadr a))))))))
  :hints (("Goal" :in-theory (disable ASSOCIATIVITY-OF-+
			      COMMUTATIVITY-OF-+))))


(defthm ++-1+n-1-5
  (implies (integerp n)
	   (equal (+ (+ (+ -1 n) 1) 1)
		  (+ 1 n)))
  :rule-classes nil)


(defthm inv-rh1-lg1-phi-c2-c1-lf2-rh2-bis
  (implies (and (inv-d2 (+ -1 n) (cadr a)) (integerp n))
	   (inv-d1 (+ 1 n)
		   (rh1 n
			(lg1 n 
			     (phi-c2-c1 n
					(lf2 n (rh2 (+ -1 n) (cadr a))))))))
  :hints (("Goal" :use ((:instance inv-rh1-lg1-phi-c2-c1-lf2-rh2 (n (+ -1 N)))
		      (:instance ++-1+n-1-2)
		      (:instance ++-1+n-1-5)))))

(DEFTHM
  INV-RH1
  (IMPLIES (AND (INV-D1 N A) (INTEGERP N))
	   (INV-D1 (+ N 1) (RH1 N A)))
  :HINTS (("Goal" :IN-THEORY (DISABLE COMMUTATIVITY-OF-+))))

(DEFTHM
  INV-RH1-bis
  (IMPLIES (AND (INV-D1 N A) (INTEGERP N))
	   (INV-D1 (+ 1 n) (RH1 N A)))
  :HINTS (("Goal" :use (:instance INV-RH1) )))


(defthm lemma-aux-3
  (implies (and (inv-d2 n a)
		(inv-d2 n b)
		(integerp n))
	   (equal (Rh1 (+ n 1)
             (LG1 (+ n 1)
                  (PHI-C2-C1 (+ n 1)
                             (LF2 (+ n 1)
                                  (GROUP-OPERATION-D2 (+ n 1)
                                                      (RH2 n A)
                                                      (RH2 n B))))))
		  (GROUP-OPERATION-d1
                  (+ (+ n 1) 1)
                  (Rh1 (+ n 1)
                       (LG1 (+ n 1)
                            (PHI-C2-C1 (+ n 1) (LF2 (+ n 1) (RH2 n A)))))
                  (Rh1 (+ n 1)
                       (LG1 (+ n 1)
                            (PHI-C2-C1 (+ n 1) (LF2 (+ n 1) (RH2 n B))))))
		  
))
:hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+))))


(defthm ++-1+n-1-6
  (implies (integerp n)
	   (equal (+ (+ (+ -1 N) 1) 1)
		  (+ 1 n)))
  :rule-classes nil)
  

(defthm lemma-aux-4
  (implies (and (inv-d2 (+ -1 N) a)
		(inv-d2 (+ -1 N) b)
		(integerp n))
	   (equal (Rh1 n
             (LG1 n
                  (PHI-C2-C1 n
                             (LF2 n
                                  (GROUP-OPERATION-D2 (+ -1 1 N)
                                                      (RH2 (+ -1 N) A)
                                                      (RH2 (+ -1 N) B))))))
		  (GROUP-OPERATION-d1
                  (+ 1 n)
                  (Rh1 n
                       (LG1 n
                            (PHI-C2-C1 n (LF2 n (RH2 (+ -1 N) A)))))
                  (Rh1 n
                       (LG1 n
                            (PHI-C2-C1 n (LF2 n (RH2 (+ -1 N)  B))))))
		  
))
:hints (("Goal" :in-theory (disable ASSOCIATIVITY-OF-+
				    )
	 :use ((:instance lemma-aux-3 (n (+ -1 N)))
		      (:instance ++-1+n-1-2)
		      (:instance ++-1+n-1-3)
		      (:instance ++-1+n-1-6)))))


(defthm external-d2-external-d1
(implies (and (integerp n)
	      (inv-d2 n a)
	      (inv-ring-z r))
(equal (Rh1 (+ n 1)
            (LG1 (+ n 1)
                 (PHI-C2-C1 (+ n 1)
                            (LF2 (+ n 1)
                                 (EXTERNAL-D2 (+ n 1)
                                              R (RH2 n a))))))
       (EXTERNAL-d1 (+ (+ n 1) 1) R
                 (Rh1 (+ n 1)
                      (LG1 (+ n 1)
                           (PHI-C2-C1 (+ n 1)
                                      (LF2 (+ n 1) (RH2 n a)))))))
)
:hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+))))


(defthm external-d2-external-d1-bis
(implies (and (integerp n)
	      (inv-d2 (+ -1 N) a)
	      (inv-ring-z r))
(equal (Rh1 n
            (LG1 n
                 (PHI-C2-C1 n
                            (LF2 n
                                 (EXTERNAL-D2 (+ -1 1 N)
                                              R (RH2 (+ -1 N) a))))))
       (EXTERNAL-d1 (+ 1 n) R
                 (Rh1 n
                      (LG1 n
                           (PHI-C2-C1 n
                                      (LF2 n (RH2 (+ -1 N) a)))))))
)
:hints (("Goal" :use ((:instance external-d2-external-d1 (n (+ -1 N)))
		      (:instance ++-1+n-1-2)
		      (:instance ++-1+n-1-3)
		      (:instance ++-1+n-1-6)))))


(defthm zero-d2-zero-d1
  (implies (integerp n)
	   (equal (Rh1 N
		       (LG1 N
			    (PHI-C2-C1 N (LF2 N (ZERO-D2 n)))))
		  (ZERO-d1 (+ N 1)))))


(defthm zero-d2-zero-d1-bis
  (implies (integerp n)
	   (equal (Rh1 N
		       (LG1 N
			    (PHI-C2-C1 N (LF2 N (ZERO-D2 (+ 1 -1 N))))))
		  (ZERO-d1 (+ 1 n))))
  :hints (("Goal" :use ((:instance zero-d2-zero-d1)
		       (:instance ++-1+n-1-4)))))

(defthm inverse-d2-inverse-d1
(implies (and (integerp n)
	      (inv-d2 n a)
	      )
(equal (Rh1 (+ n 1)
            (LG1 (+ n 1)
                 (PHI-C2-C1 (+ n 1)
                            (LF2 (+ n 1)
                                 (inverse-D2 (+ n 1)
                                               (RH2 n a))))))
       (inverse-d1 (+ (+ n 1) 1)
                 (Rh1 (+ n 1)
                      (LG1 (+ n 1)
                           (PHI-C2-C1 (+ n 1)
                                      (LF2 (+ n 1) (RH2 n a)))))))
)
:hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+))))

(defthm inverse-d2-inverse-d1-bis
(implies (and (integerp n)
	      (inv-d2 (+ -1 N) a)
	      )
(equal (Rh1 n
            (LG1 n
                 (PHI-C2-C1 n
                            (LF2 n
                                 (inverse-D2 (+ 1 -1 N)
                                              (RH2 (+ -1 N) a))))))
       (inverse-d1 (+ 1 n) 
                 (Rh1 n
                      (LG1 n
                           (PHI-C2-C1 n
                                      (LF2 n (RH2 (+ -1 N) a)))))))
)
:hints (("Goal" :use ((:instance inverse-d2-inverse-d1 (n (+ -1 N)))
		      (:instance ++-1+n-1-2)
		      (:instance ++-1+n-1-4)
		      (:instance ++-1+n-1-6)))))



(defthm inv-rh1-lg1-phi-c2-c1-lf2-rg2
  (implies (and (inv-h2 n (cadr a)) (integerp n))
	   (inv-d1 (+ n 1)
		   (rh1 n
			(lg1 n 
			     (phi-c2-c1 n
					(lf2 n (rg2 n(cadr a))))))))
  :hints (("Goal" :in-theory (disable ASSOCIATIVITY-OF-+
			      COMMUTATIVITY-OF-+))))


(defthm inv-rh1-lg1-phi-c2-c1-lf2-rg2-bis
  (implies (and (inv-h2 (+ -1 n) (cadr a)) (integerp n))
	   (inv-d1 n
		   (rh1 (+ -1 n)
			(lg1 (+ -1 n)
			     (phi-c2-c1 (+ -1 n)
					(lf2 (+ -1 n) (rg2 (+ -1 n) (cadr a))))))))
  :hints (("Goal" :use ((:instance inv-rh1-lg1-phi-c2-c1-lf2-rg2 (n (+ -1 N)))
		      (:instance ++-1+n-1-2)
		      (:instance ++-1+n-1-3)
		      (:instance ++-1+n-1-5)
		      (:instance ++-1+n-1-6)))))


(defthm +1-1+n
  (implies (integerp n)
	   (equal (+ 1 -1 n)
		  n))
  :rule-classes nil)

(defthm inverse-zero-d1
  (IMPLIES (INTEGERP N)
         (EQUAL (GROUP-OPERATION-D1 N (ZERO-D1 N)
                                    (INVERSE-D1 N (ZERO-D1 (+ 1 -1 N))))
                (ZERO-D1 N)))
  :hints (("Goal" :use (:instance +1-1+n))))

(defthm lemma-aux-5
  (implies (and (integerp n)
		(inv-h1 n a1)
		(INV-H2 (+ -1 N) A3))
	   (equal (INVERSE-D1 (+ 1 -1 N)
                  (RH1 (+ -1 N)
                       (LG1 (+ -1 N)
                            (PHI-C2-C1 (+ -1 N)
                                       (LF2 (+ -1 N) (RG2 (+ -1 N) A3))))))
		  (INVERSE-D1 N
                        (RH1 (+ -1 N)
                             (LG1 (+ -1 N)
                                  (PHI-C2-C1 (+ -1 N)
                                             (LF2 (+ -1 N)
                                                  (RG2 (+ -1 N) A3))))))
		  ))
  :hints (("Goal" :use (:instance +1-1+n))))

(defthm lemma-aux-6
  (implies (and (inv-d1 n a)
		(inv-d1 n b)
		(integerp n))
	   (equal (inverse-d1 n (group-operation-d1 (+ 1 -1 n) a b))
		  (group-operation-d1 n (inverse-d1 n a) (inverse-d1 n b))))
  :hints (("Goal" :use (:instance +1-1+n))))


(defthm lemma-aux-7
  (implies (and (inv-d1 n a)
		(integerp n)
		(inv-ring-z r))
	   (equal (inverse-d1 n (external-d1 (+ 1 -1 n) r a))
		  (external-d1 n r (inverse-d1 n a))))
  :hints (("Goal" :use (:instance +1-1+n))))



(defthm lemma-aux-8
  (implies (and (inv-d1 n a)
		(integerp n))
  (equal (INVERSE-H1 (+ n 1)
	      (RF1 (+ n 1)
		   (RH1 n a)))
	 (zero-h1 (+ n 1))))
)

(defthm lemma-aux-9
  (implies (and (inv-d1 (+ -1 n) a)
		(integerp n))
  (equal (INVERSE-H1 n
	      (RF1 n
		   (RH1 (+ -1 n) a)))
	 (zero-h1 n)))
:hints (("Goal" :use ((:instance lemma-aux-8 (n (+ -1 n)))
		      (:instance ++-1+n-1-2))))
)

(defthm lemma-aux-10
  (implies (and (inv-d2 n a)
		(integerp n))
  (equal (RH2 (+ N 1) (RH2 N A))
	 (zero-d2 (+ (+ n 1) 1))))
:hints (("Goal" :in-theory (disable ASSOCIATIVITY-OF-+
				   ))))

(defthm lemma-aux-11
  (implies (and (inv-d2 n a)
		(integerp n))
  (equal (RH2 (+ n 1)
	      (INVERSE-D2 (+ N 1) (RH2 n a)))
	 (zero-d2 (+ (+ n 1) 1))))
:hints (("Goal" :in-theory (disable ASSOCIATIVITY-OF-+
				    COMMUTATIVITY-OF-+))))

(defthm lemma-aux-12
  (implies (and (inv-d2 (+ -1 n) a)
		(integerp n))
  (equal (RH2 (+ (+ -1 n) 1)
	      (INVERSE-D2 (+ (+ -1 n) 1) (RH2 (+ -1 n) a)))
	 (zero-d2 (+ (+ (+ -1 n) 1) 1))))
:hints (("Goal" :use ((:instance lemma-aux-11 (n (+ -1 n)))
		      (:instance ++-1+n-1-2))))
)

(defthm lemma-aux-13
  (implies (and (inv-d2 (+ -1 n) a)
		(integerp n))
  (equal (RH2 (+ -1 1 n)
	      (INVERSE-D2 n (RH2 (+ -1 n) a)))
	 (zero-d2 (+ 1 n))))
:hints (("Goal" :use ((:instance lemma-aux-12)
		      (:instance ++-1+n-1-2)
		      (:instance ++-1+n-1-3)
		      (:instance ++-1+n-1-5)
		      (:instance ++-1+n-1-6))))
)



(defthm lemma-aux-14
  (implies (and (inv-d2 n a)
		(integerp n))
  (equal (Rf2 (+ N 1) (RH2 N A))
	 (zero-h2 (+ n 1))))
:hints (("Goal" :in-theory (disable ASSOCIATIVITY-OF-+
				   ))))

(defthm lemma-aux-15
  (implies (and (inv-d2 n a)
		(integerp n))
  (equal (Rf2 (+ n 1)
	      (INVERSE-D2 (+ N 1) (RH2 n a)))
	 (zero-h2 (+ n 1) )))
:hints (("Goal" :in-theory (disable ASSOCIATIVITY-OF-+
				    COMMUTATIVITY-OF-+))))

(defthm lemma-aux-16
  (implies (and (inv-d2 (+ -1 n) a)
		(integerp n))
  (equal (Rf2 (+ -1 1 n)
	      (INVERSE-D2 n (RH2 (+ -1 n) a)))
	 (zero-h2 (+ -1 1 n))))
:hints (("Goal" :use ((:instance lemma-aux-15 (n (+ -1 n)))
		      (:instance ++-1+n-1-2))))
)

(defthm lemma-aux-17
  (implies (and (inv-d1 n a)
		(integerp n))
  (equal (Rh1 (+ N 1) (RH1 N A))
	 (zero-d1 (+ (+ n 1) 1))))
:hints (("Goal" :in-theory (disable ASSOCIATIVITY-OF-+))))

(defthm +-1+2+n
  (implies (integerp n)
	   (equal (+ -1 2 n)
		  (+ 1 n)))
  :rule-classes nil)

(defthm lemma-aux-18
  (implies (and (inv-d1 (+ -1 n) a)
		(integerp n))
  (equal (Rh1 n
	      (RH1 (+ -1 n) A))
	 (zero-d1 (+ 1 n))))
:hints (("Goal" 
	 :use ((:instance lemma-aux-17 (n (+ -1 n)))
		(:instance ++-1+n-1-2)      
	       (:instance +-1+2+n ))))
)


(defthm +-1-1-1-n
  (implies (integerp n)
	   (equal (+ 1 n)
		  (+ -1 1 1 n)))
:rule-classes nil)

(defthm zero-d2-zero-d2
  (implies (integerp n)
	   (equal (zero-d2 (+ -1 1 1 n))
		  (zero-d2 (+ 1 n))
		  ))
  :hints (("Goal" 
	 :use (:instance  +-1-1-1-n ))))


(defthm +-1+2+n
  (implies (integerp n)
	   (equal (+ -1 2 n)
		  (+ 1 n)))
  :rule-classes nil)

(defthm lemma-aux-18
  (implies (and (inv-d1 (+ -1 n) a)
		(integerp n))
  (equal (Rh1 n
	      (RH1 (+ -1 n) A))
	 (zero-d1 (+ 1 n))))
:hints (("Goal" 
	 :use ((:instance lemma-aux-17 (n (+ -1 n)))
		(:instance ++-1+n-1-2)      
	       (:instance +-1+2+n ))))
)


;----------------------------------------------------------------------------------------------------



(defthm lemma-aux-3
  (implies (and (inv-d2 n a)
		(inv-d2 n b)
		(integerp n))
	   (equal (Rh1 (+ n 1)
             (LG1 (+ n 1)
                  (PHI-C2-C1 (+ n 1)
                             (LF2 (+ n 1)
                                  (GROUP-OPERATION-D2 (+ n 1)
                                                      (RH2 n A)
                                                      (RH2 n B))))))
		  (GROUP-OPERATION-d1
                  (+ (+ n 1) 1)
                  (Rh1 (+ n 1)
                       (LG1 (+ n 1)
                            (PHI-C2-C1 (+ n 1) (LF2 (+ n 1) (RH2 n A)))))
                  (Rh1 (+ n 1)
                       (LG1 (+ n 1)
                            (PHI-C2-C1 (+ n 1) (LF2 (+ n 1) (RH2 n B))))))
		  
))
:hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+))))


(defthm lemma-aux-19
  (implies (and (inv-d2 n a)
		(inv-d2 n b)
		(integerp n))
	   (equal 
	    (GROUP-OPERATION-H1
	     n
	     (RF1 n (LG1 n  (PHI-C2-C1 n (LF2 n a))))
	     (RF1 n  (LG1 n (PHI-C2-C1 n (LF2 n b)))))
	    
	    (RF1 n  (LG1 n  
			 (PHI-C2-C1 n (LF2 n
					   (group-operation-d2 n a
							       b))))


	    )))
  :hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+))))


(defthm inv-d-d2-rh2
  (implies (and (inv-d2 n a)
		(integerp n))
	   (inv-d2 (+ (+ n 1) -1) (d-d2 (+ n 1) (rh2 n a))))
  :hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+
				      ASSOCIATIVITY-OF-+))))

(defthm +n+1-1
  (implies (integerp n)
	   (equal (+ (+ n 1) -1)
		  n))
  :rule-classes nil)

(defthm inv-d-d2-rh2-bis
  (implies (and (inv-d2 n a)
		(integerp n))
	   (inv-d2 n (d-d2 (+ n 1) (rh2 n a))))
  :hints (("Goal"  :use ((:instance inv-d-d2-rh2)
		 (:instance +n+1-1)))))
	   

(defthm lemma-aux-20
  (implies (and (inv-d2 n a)
		(integerp n))
	   (equal 
	    (GROUP-OPERATION-H1
	     n
	     (RF1 n
		  (LG1 n
		       (PHI-C2-C1 n
				  (LF2 n
				       (D-D2 (+ N 1) (RH2 n a))))))
	     (RF1 n
		  (LG1 n
		       (PHI-C2-C1 n
				  (LF2 n
				       (RG2 n (RF2 n a)))))))
	    
	    (RF1 n
		  (LG1 n
		       (PHI-C2-C1 n
				  (LF2 n
				       (group-operation-d2 n (D-D2 (+ N 1) (RH2 n a))
							  (RG2 n (RF2 n a))))))
	    )))
  :hints (("Goal" :in-theory (disable |HOMOTOPY-EQUIVALENCE-1-is-an-homotopy-equivalence|)
	   :use ((:instance inv-d-d2-rh2-bis)
		 (:instance lemma-aux-19
				   (a (D-D2 (+ N 1) (RH2 n a)))
				   (b (RG2 n (RF2 n a))))))))


(defthm lemma-aux-21
  (implies (and (inv-d2 (+ -1 n) a)
		(integerp n))
	   (equal 
	    (GROUP-OPERATION-H1
	     (+ -1 n)
	     (RF1 (+ -1 n)
		  (LG1 (+ -1 n)
		       (PHI-C2-C1 (+ -1 n)
				  (LF2 (+ -1 n)
				       (D-D2 n (RH2 (+ -1 n) a))))))
	     (RF1 (+ -1 n)
		  (LG1 (+ -1 n)
		       (PHI-C2-C1 (+ -1 n)
				  (LF2 (+ -1 n)
				       (RG2 (+ -1 n) (RF2 (+ -1 n) a)))))))
	    
	    (RF1 (+ -1 n)
		  (LG1 (+ -1 n)
		       (PHI-C2-C1 (+ -1 n)
				  (LF2 (+ -1 n)
				       (group-operation-d2 (+ -1 n) (D-D2 n (RH2 (+ -1 n) a))
							  (RG2 (+ -1 n) (RF2 (+ -1 n) a))))))
	    )))
  :hints (("Goal" :in-theory (disable |HOMOTOPY-EQUIVALENCE-1-is-an-homotopy-equivalence|)
	   :use ((:instance lemma-aux-20 (n (+ -1 n)))
		 (:instance +1-1+n)
		 (:instance ++-1+n-1-2)
		 (:instance ++-1+n-1-3)
		 (:instance ++-1+n-1-5)
		 (:instance ++-1+n-1-6)))))


(defthm lemma-aux-22
  (implies (and (inv-d2 n gnrt)
		(integerp n))
	   (EQUAL
                   (GROUP-OPERATION-D2 N (RH2 (1- N) (D-D2 N GNRT))
                                       (D-D2 (1+ N) (RH2 N GNRT)))
                   (GROUP-OPERATION-D2 N GNRT
                                       (INVERSE-D2 N (RG2 N (RF2 N GNRT)))))
	   )
   )


(defthm lemma-aux-23
  (implies (and (inv-d2 n gnrt)
		(integerp n))
	   (EQUAL  (group-operation-d2 n
                   (GROUP-OPERATION-D2 N (RH2 (1- N) (D-D2 N GNRT))
                                       (D-D2 (1+ N) (RH2 N GNRT)))
		   (inverse-d2 n (RH2 (1- N) (D-D2 N GNRT))))
		   (group-operation-d2 n
				       (GROUP-OPERATION-D2 N GNRT
							   (INVERSE-D2 N (RG2 N (RF2 N GNRT))))
				       (inverse-d2 n (RH2 (1- N) (D-D2 N GNRT)))))
	   )
   )

(defthm group-operation-d2-commutativity
  (implies (and (integerp n)
		(inv-d2 n a)
		(inv-d2 n b))
	   (equal (group-operation-d2 n a b)
		  (group-operation-d2 n b a)))
  )


(defthm group-operation-inverse-d2
  (implies (and (inv-d2 n a)
		(inv-d2 n b)
		(integerp n))
	   (equal (group-operation-d2 n (group-operation-d2 n a b)
				      (inverse-d2 n a))
		  b))
  :hints (("Goal" :use ((:instance group-operation-d2-commutativity)
			(:instance help1 (a b) (b a) (c (inverse-d2 n a)))))))
		  



(defthm inv-d-d2-rh2
  (implies (and (inv-d2 n a)
		(integerp n))
	   (inv-d2 (+ (+ n 1) -1) (d-d2 (+ n 1) (rh2 n a))))
  :hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+
				      ASSOCIATIVITY-OF-+))))

(defthm +n+1-1
  (implies (integerp n)
	   (equal (+ (+ n 1) -1)
		  n))
  :rule-classes nil)

(defthm inv-d-d2-rh2-bis
  (implies (and (inv-d2 n a)
		(integerp n))
	   (inv-d2 n (d-d2 (+ n 1) (rh2 n a))))
  :hints (("Goal"  :use ((:instance inv-d-d2-rh2)
		 (:instance +n+1-1)))))




(defthm inv-rh2-d-d2
  (implies (and (inv-d2 n a)
		(integerp n))
	   (inv-d2 (+ (+ n -1) 1) (rh2 (+ n -1) (d-d2 n a))))
  :hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+
				      ASSOCIATIVITY-OF-+))))


(defthm inv-rh2-d-d2-bis
  (implies (and (inv-d2 n a)
		(integerp n))
	   (inv-d2 n (rh2 (+ n -1) (d-d2 n a))))
  :hints (("Goal"  :use ((:instance inv-rh2-d-d2)
		 (:instance ++-1+n-1-2)))))


(defthm lemma-aux-24
  (implies (and (inv-d2 n gnrt)
		(integerp n))
	   (EQUAL  (group-operation-d2 n
                   (GROUP-OPERATION-D2 N (RH2 (1- N) (D-D2 N GNRT))
                                       (D-D2 (1+ N) (RH2 N GNRT)))
		   (inverse-d2 n (RH2 (1- N) (D-D2 N GNRT))))
		   (D-D2 (1+ N) (RH2 N GNRT)))
	   )
   :hints (("Goal" :use ((:instance inv-rh2-d-d2-bis (a gnrt))
			 (:instance inv-d-d2-rh2-bis (a gnrt))
			 (:instance group-operation-inverse-d2 
				    (a (RH2 (1- N) (D-D2 N GNRT)))
				    (b (D-D2 (1+ N) (RH2 N GNRT))))))))


(defthm lemma-aux-25
  (implies (and (inv-d2 n gnrt)
		(integerp n))
	   (EQUAL  (D-D2 (1+ N) (RH2 N GNRT))
		   (group-operation-d2 n
				       (GROUP-OPERATION-D2 N GNRT
							   (INVERSE-D2 N (RG2 N (RF2 N GNRT))))
				       (inverse-d2 n (RH2 (1- N) (D-D2 N GNRT)))))
	   )
   :hints (("Goal" :use ((:instance lemma-aux-23)
			 (:instance lemma-aux-24)))))



(defthm group-operation-group-operation-d2
  (implies (and (inv-d2 n a)
		(inv-d2 n b)
		(inv-d2 n c)
		(integerp n))
	   (equal (group-operation-d2 n (group-operation-d2 n a b) c)
		  (group-operation-d2 n (group-operation-d2 n a c) b)))
  :hints (("Goal" :use ((:instance group-operation-d2-commutativity (a (group-operation-d2 n a b)) (b c))
			(:instance group-operation-d2-commutativity (a (group-operation-d2 n a c)) (b b))
			(:instance group-operation-d2-commutativity (a a) (b b))
			(:instance group-operation-d2-commutativity (a a) (b c))
			(:instance help1 (a c) (b b) (c a))
			(:instance help1 (a b) (b c) (c a))
			(:instance group-operation-d2-commutativity (a b) (b c))))))


(in-theory (disable  group-operation-group-operation-d2))

(defthm lemma-aux-26
  (implies (and (inv-d2 n gnrt)
		(integerp n))
	   (EQUAL  (group-operation-d2 n
				       (GROUP-OPERATION-D2 N GNRT
							   (INVERSE-D2 N (RG2 N (RF2 N GNRT))))
				       (inverse-d2 n (RH2 (1- N) (D-D2 N GNRT))))
		   (group-operation-d2 n
				       (GROUP-OPERATION-D2 N GNRT
							   (inverse-d2 n (RH2 (1- N) (D-D2 N GNRT))))
				       (INVERSE-D2 N (RG2 N (RF2 N GNRT)))
				       )
		   )
	   )
  :hints (("Goal" :use ((:instance inv-rh2-d-d2-bis (a gnrt))
			(:instance group-operation-group-operation-d2
				   (a gnrt)
				   (b (INVERSE-D2 N (RG2 N (RF2 N GNRT))))
				   (c (inverse-d2 n (RH2 (1- N) (D-D2 N GNRT)))))))))



(defthm lemma-aux-27
  (implies (and (inv-d2 n gnrt)
		(integerp n))
	   (EQUAL  (D-D2 (1+ N) (RH2 N GNRT))
		   (group-operation-d2 n
				       (GROUP-OPERATION-D2 N GNRT
							   (inverse-d2 n (RH2 (1- N) (D-D2 N GNRT))))
				       (INVERSE-D2 N (RG2 N (RF2 N GNRT)))
				       )
		   )
	   )
  :hints (("Goal" :use ((:instance lemma-aux-25)
			(:instance lemma-aux-26)
			))))

(defthm lemma-aux-28
  (implies (and (inv-d2 n gnrt)
		(integerp n))
	   (EQUAL  (group-operation-d2 n (D-D2 (1+ N) (RH2 N GNRT))
				       (inverse-d2 n (inverse-D2 N (RG2 N (RF2 N GNRT))))
				       )
		   (group-operation-d2 n
		   (group-operation-d2 n
				       (GROUP-OPERATION-D2 N GNRT
							   (inverse-d2 n (RH2 (1- N) (D-D2 N GNRT))))
				       (INVERSE-D2 N (RG2 N (RF2 N GNRT)))
				       )
		   (inverse-d2 n (inverse-D2 N (RG2 N (RF2 N GNRT)))))
		   )
	   )
  :hints (("Goal" :use ((:instance lemma-aux-27)
			
			))))



(defthm lemma-aux-29
  (implies (and (inv-d2 n gnrt)
		(integerp n))
	   (EQUAL  
		  (group-operation-d2 n
		   (group-operation-d2 n
				       (GROUP-OPERATION-D2 N GNRT
							   (inverse-d2 n (RH2 (1- N) (D-D2 N GNRT))))
				       (INVERSE-D2 N (RG2 N (RF2 N GNRT)))
				       )
		   (inverse-d2 n (inverse-D2 N (RG2 N (RF2 N GNRT))))) 
		   
		  (GROUP-OPERATION-D2 N GNRT
				      (inverse-d2 n (RH2 (1- N) (D-D2 N GNRT))))))
  :hints (("Goal" :use ((:instance inv-rh2-d-d2-bis (a gnrt))
			(:instance group-operation-inverse-d2
				   (a (GROUP-OPERATION-D2 N GNRT
							   (inverse-d2 n (RH2 (1- N) (D-D2 N GNRT)))))
				   (b (INVERSE-D2 N (RG2 N (RF2 N GNRT))))
				   )
			))))

(DEFTHM
  INVERSE-d2-INVERSE-D2
  (IMPLIES (AND (INV-D2 N A) (INTEGERP N))
	   (EQUAL (INVERSE-D2 N (INVERSE-D2 n A))
		  a))
                   )

(defthm lemma-aux-30
  (implies (and (inv-d2 n gnrt)
		(integerp n))
	   (EQUAL  (group-operation-d2 n (D-D2 (+ N 1) (RH2 N GNRT))
				       (RG2 N (RF2 N GNRT))
				       )	  	   
		  (GROUP-OPERATION-D2 N GNRT
				      (inverse-d2 n (RH2 (1- N) (D-D2 N GNRT))))))
  :hints (("Goal" :use ((:instance LEMMA-AUX-27)
			(:instance LEMMA-AUX-29)
			(:instance inverse-d2-inverse-d2 (a (RG2 N (RF2 N GNRT))) )
			))))



(defthm lemma-aux-31
  (implies (and (inv-d2 n a)
		(integerp n))
	   (equal 
	    (GROUP-OPERATION-H1
	     n
	     (RF1 n
		  (LG1 n
		       (PHI-C2-C1 n
				  (LF2 n
				       (D-D2 (+ N 1) (RH2 n a))))))
	     (RF1 n
		  (LG1 n
		       (PHI-C2-C1 n
				  (LF2 n
				       (RG2 n (RF2 n a)))))))
	    
	    (RF1 n
		  (LG1 n
		       (PHI-C2-C1 n
				  (LF2 n
				       (GROUP-OPERATION-D2 N a
							   (inverse-d2 n (RH2 (1- N) (D-D2 N a)))))))
	    )))
  :hints (("Goal" :in-theory (disable |HOMOTOPY-EQUIVALENCE-1-is-an-homotopy-equivalence|)
	   :use ((:instance lemma-aux-20)
		 (:instance lemma-aux-30 (gnrt a))))))


(defthm lemma-aux-32
  (implies (and (inv-d2 (+ -1 n)  a)
		(integerp n))
	   (equal 
	    (GROUP-OPERATION-H1
	     (+ -1 n)
	     (RF1 (+ -1 n)
		  (LG1 (+ -1 n)
		       (PHI-C2-C1 (+ -1 n)
				  (LF2 (+ -1 n)
				       (D-D2 n (RH2 (+ -1 n) a))))))
	     (RF1 (+ -1 n)
		  (LG1 (+ -1 n)
		       (PHI-C2-C1 (+ -1 n)
				  (LF2 (+ -1 n)
				       (RG2 (+ -1 n) (RF2 (+ -1 n) a)))))))	    
	    (RF1 (+ -1 n)
		  (LG1 (+ -1 n)
		       (PHI-C2-C1 (+ -1 n)
				  (LF2 (+ -1 n)
				       (group-operation-d2 (+ -1 n) a
							  (inverse-d2 (+ -1 n) (RH2 (+ (1- N) -1) (D-D2 (1- N) a)))))))
	    )))
  :hints (("Goal" :in-theory (disable |HOMOTOPY-EQUIVALENCE-1-is-an-homotopy-equivalence|)
	   :use ((:instance lemma-aux-31 (n (+ -1 n)))
		 (:instance +1-1+n)
		 (:instance ++-1+n-1-2)
		 (:instance ++-1+n-1-3)
		 (:instance ++-1+n-1-5)
		 (:instance ++-1+n-1-6)))))


(defthm lemma-aux-33
  (implies (and (inv-d2 n a)
              (integerp n))
         (equal 
          (RF1 n
               (LG1 n
                    (PHI-C2-C1 n
                               (LF2 n 
                                    (group-operation-d2 n a
                                                        (inverse-d2 n (RH2 (+ n -1) (D-D2 n a)))))))
               )
          (group-operation-h1 n
                              (RF1 n
                                   (LG1 n
                                        (PHI-C2-C1 n
                                                   (LF2 n a))))
                              
                              (RF1 n
                                   (LG1 n
                                        (PHI-C2-C1 n
                                                   (LF2 n
                                                        (inverse-d2 n (RH2 (+ n -1) (D-D2 n a)))
                                                        )))
                                   ))))
  :hints (("Goal" :in-theory (disable |HOMOTOPY-EQUIVALENCE-1-is-an-homotopy-equivalence|
				      |HOMOTOPY-EQUIVALENCE-2-is-an-homotopy-equivalence|)
	   :use ((:instance inv-rh2-d-d2-bis)
		 (:instance lemma-aux-19 (n (+ -1 n))
			    (a a)
			    (b (inverse-d2 (+ -1 n) (RH2 (+ (1- N) -1) (D-D2 (1- N) a)))))
		 ))))

(defthm lemma-aux-34
  (implies (and (inv-d2 (+ -1 n)  a)
              (integerp n))
         (equal 
          (RF1 (+ -1 n)
               (LG1 (+ -1 n)
                    (PHI-C2-C1 (+ -1 n)
                               (LF2 (+ -1 n)
                                    (group-operation-d2 (+ -1 n) a
                                                        (inverse-d2 (+ -1 n) (RH2 (+ (1- N) -1) (D-D2 (1- N) a)))))))
               )
          (group-operation-h1 (+ -1 n)
                              (RF1 (+ -1 n)
                                   (LG1 (+ -1 n)
                                        (PHI-C2-C1 (+ -1 n)
                                                   (LF2 (+ -1 n) a))))
                              
                              (RF1 (+ -1 n)
                                   (LG1 (+ -1 n)
                                        (PHI-C2-C1 (+ -1 n)
                                                   (LF2 (+ -1 n)
                                                        (inverse-d2 (+ -1 n) (RH2 (+ (1- N) -1) (D-D2 (1- N) a)))
                                                        )))
                                   ))))
  :hints (("Goal" :in-theory (disable |HOMOTOPY-EQUIVALENCE-1-is-an-homotopy-equivalence|)
	   :use ((:instance lemma-aux-33 (n (+ -1 n)))
		 (:instance +1-1+n)
		 (:instance ++-1+n-1-2)
		 (:instance ++-1+n-1-3)
		 (:instance ++-1+n-1-5)
		 (:instance ++-1+n-1-6)))))


(DEFTHM
  LEMMA-AUX-35
  (IMPLIES
   (AND (INV-D2 N A)	
	(INTEGERP N))
   (EQUAL
    (inverse-H1 N (RF1 N (LG1 N (PHI-C2-C1 N (LF2 N a)))))
    (RF1 N
	 (LG1 N
	      (PHI-C2-C1 N
			 (LF2 N (inverse-D2 n A)))))))
  :HINTS (("Goal" :IN-THEORY (DISABLE COMMUTATIVITY-OF-+))))




(defthm lemma-aux-36
  (implies (and (inv-d2 (+ -1 n)  a)
              (integerp n))
         (equal 
          (RF1 (+ -1 n)
               (LG1 (+ -1 n)
                    (PHI-C2-C1 (+ -1 n)
                               (LF2 (+ -1 n)
                                    (group-operation-d2 (+ -1 n) a
                                                        (inverse-d2 (+ -1 n) (RH2 (+ (1- N) -1) (D-D2 (1- N) a)))))))
               )
          (group-operation-h1 (+ -1 n)
                              (RF1 (+ -1 n)
                                   (LG1 (+ -1 n)
                                        (PHI-C2-C1 (+ -1 n)
                                                   (LF2 (+ -1 n) a))))
                              
                              (inverse-h1 (+ -1 n) (RF1 (+ -1 n)
                                   (LG1 (+ -1 n)
                                        (PHI-C2-C1 (+ -1 n)
                                                   (LF2 (+ -1 n)
                                                        (RH2 (+ (1- N) -1) (D-D2 (1- N) a)))
                                                        )))
                                   ))))
  :hints (("Goal" :in-theory (disable |HOMOTOPY-EQUIVALENCE-1-is-an-homotopy-equivalence|)
	   :use ((:instance inv-rh2-d-d2-bis (n (+ -1 n)))
		 (:instance lemma-aux-34)
		 (:instance lemma-aux-35 (n (+ -1 n))
			    (a (RH2 (+ (1- N) -1) (D-D2 (1- N) a))))
		))))



(defthm lemma-aux-37
  (implies (and (inv-d2 (+ -1 n)  a)
              (integerp n))
         (equal 
          (GROUP-OPERATION-H1
	     (+ -1 n)
	     (RF1 (+ -1 n)
		  (LG1 (+ -1 n)
		       (PHI-C2-C1 (+ -1 n)
				  (LF2 (+ -1 n)
				       (D-D2 n (RH2 (+ -1 n) a))))))
	     (RF1 (+ -1 n)
		  (LG1 (+ -1 n)
		       (PHI-C2-C1 (+ -1 n)
				  (LF2 (+ -1 n)
				       (RG2 (+ -1 n) (RF2 (+ -1 n) a)))))))
          (group-operation-h1 (+ -1 n)
                              (RF1 (+ -1 n)
                                   (LG1 (+ -1 n)
                                        (PHI-C2-C1 (+ -1 n)
                                                   (LF2 (+ -1 n) a))))
                              
                              (inverse-h1 (+ -1 n) (RF1 (+ -1 n)
                                   (LG1 (+ -1 n)
                                        (PHI-C2-C1 (+ -1 n)
                                                   (LF2 (+ -1 n)
                                                        (RH2 (+ (1- N) -1) (D-D2 (1- N) a)))
                                                        )))
                                   ))))
  :hints (("Goal" :in-theory (disable |HOMOTOPY-EQUIVALENCE-1-is-an-homotopy-equivalence|)
	   :use ((:instance lemma-aux-32)
		 (:instance lemma-aux-36)))))





(DEFTHM
  HELP1-H1
  (IMPLIES
   (AND (INV-H1 N A)
	(INV-H1 N B)
	(INV-H1 N C)
	(INTEGERP N))
   (EQUAL (GROUP-OPERATION-H1 N (GROUP-OPERATION-H1 N A B)
			      C)
	  (GROUP-OPERATION-H1 N A (GROUP-OPERATION-H1 N B C))))
  :HINTS (("Goal" :USE ((:INSTANCE |H1-is-a-chain-complex|)))))


(DEFTHM
  HELP1-H1-2
  (IMPLIES
   (AND (INV-H1 (+ -1 N) A)
	(INV-H1 (+ -1 N) B)
	(INV-H1 (+ -1 N) C)
	(INTEGERP N))
   (EQUAL (GROUP-OPERATION-H1 (+ -1 N) (GROUP-OPERATION-H1 (+ -1 N) A B)
			      C)
	  (GROUP-OPERATION-H1 (+ -1 N) A (GROUP-OPERATION-H1 (+ -1 N) B C))))
  :HINTS (("Goal" :USE ((:INSTANCE HELP1-H1 (n (+ -1 N)))))))

(defthm inv-rf1-d-d1
  (implies (and (inv-d1 n a)
		(integerp n))
	   (inv-h1 (+ n -1) (rf1 (+ n -1) (d-d1 n a))))
  :hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+
				      ASSOCIATIVITY-OF-+))))

(DEFTHM
                  INV-RF1-D-D1
                  (IMPLIES (AND (INV-D1 N A) (INTEGERP N))
                           (INV-H1 (+ N -1)
                                   (RF1 (+ N -1) (D-D1 N A))))
                  :HINTS (("Goal" :IN-THEORY (DISABLE COMMUTATIVITY-OF-+
                                                      ASSOCIATIVITY-OF-+))))

(DEFTHM
  INV-RF1-D-D1-2
  (IMPLIES (AND (INV-D1 N A) (INTEGERP N))
	   (INV-H1 (+ -1 n)
		   (RF1 (+ -1 n) (D-D1 N A))))
  :HINTS (("Goal" :IN-THEORY (DISABLE COMMUTATIVITY-OF-+
				      ASSOCIATIVITY-OF-+))))



(defthm inv-rf1-lg1-phi-c2-c1-lf2-d-d2-rh2
  (implies (and (inv-d2 n a)
		(integerp n))
	   (inv-h1 n
		   (RF1 n
                 (LG1 n
                      (PHI-C2-C1 n
                                 (LF2 n
                                      (D-D2 (+ N 1) (RH2 n A))))))))
  :HINTS (("Goal" :IN-THEORY (DISABLE COMMUTATIVITY-OF-+
				      ASSOCIATIVITY-OF-+))))


(defthm inv-rf1-lg1-phi-c2-c1-lf2-d-d2-rh2-2
  (implies (and (inv-d2 (+ -1 n) a)
		(integerp n))
	   (inv-h1 (+ -1 N) (RF1 (+ -1 N)
                 (LG1 (+ -1 N)
                      (PHI-C2-C1 (+ -1 N)
                                 (LF2 (+ -1 N)
                                      (D-D2 n (RH2 (+ -1 N) A))))))))
  :HINTS (("Goal" 
	   :use ((:instance 
			inv-rf1-lg1-phi-c2-c1-lf2-d-d2-rh2 
			(n (+ -1 n)))
		 (:instance +1-1+n)
		 (:instance ++-1+n-1-2)
		 (:instance ++-1+n-1-3)
		 (:instance ++-1+n-1-5)
		 (:instance ++-1+n-1-6)
		))))





(defthm lemma-aux-38
  (IMPLIES
 (AND (INV-D1 N A1)
      (INV-D2 (+ -1 N) A3)
      (INTEGERP N))
 (EQUAL
  (GROUP-OPERATION-H1
       (+ -1 N)
       (GROUP-OPERATION-H1
            (+ -1 N)
            (RF1 (+ -1 N) (D-D1 N A1))
            (RF1 (+ -1 N)
                 (LG1 (+ -1 N)
                      (PHI-C2-C1 (+ -1 N)
                                 (LF2 (+ -1 N)
                                      (D-D2 N (RH2 (+ -1 N) A3)))))))
       (RF1 (+ -1 N)
            (LG1 (+ -1 N)
                 (PHI-C2-C1 (+ -1 N)
                            (LF2 (+ -1 N)
                                 (RG2 (+ -1 N) (RF2 (+ -1 N) A3)))))))
  (GROUP-OPERATION-H1
   (+ -1 N)
   (RF1 (+ -1 N) (D-D1 N A1))
   (GROUP-OPERATION-H1
     (+ -1 N)
     (RF1 (+ -1 N)
                 (LG1 (+ -1 N)
                      (PHI-C2-C1 (+ -1 N)
                                 (LF2 (+ -1 N)
                                      (D-D2 N (RH2 (+ -1 N) A3))))))
     (RF1 (+ -1 N)
            (LG1 (+ -1 N)
                 (PHI-C2-C1 (+ -1 N)
                            (LF2 (+ -1 N)
                                 (RG2 (+ -1 N) (RF2 (+ -1 N) A3))))))))))
 :hints (("Goal" :in-theory (disable lemma-aux-37 
				     lemma-aux-35
				     lemma-aux-32
				     lemma-aux-21
				     COMMUTATIVITY-OF-+
				     )
	  :use ((:instance INV-RF1-D-D1-2 (a a1))
		(:instance inv-rf1-lg1-phi-c2-c1-lf2-d-d2-rh2-2 (a a3))
		(:instance HELP1-H1-2
			   (a (RF1 (+ -1 N) (D-D1 N A1)))
			   (b (RF1 (+ -1 N)
				   (LG1 (+ -1 N)
					(PHI-C2-C1 (+ -1 N)
						   (LF2 (+ -1 N)
							(D-D2 N (RH2 (+ -1 N) A3)))))))
			   (c (RF1 (+ -1 N)
				   (LG1 (+ -1 N)
					(PHI-C2-C1 (+ -1 N)
						   (LF2 (+ -1 N)
							(RG2 (+ -1 N) (RF2 (+ -1 N) A3))))))))))))
  








;----------------------------------------------------------------------------------------------------

(defthm lemma-aux-39
  (implies (and (inv-h2 n a)
		(integerp n))
	   (equal 
	    (Rh1 (+ n -1) (d-d1 n (LG1 n (PHI-C2-C1 n (LF2 n (rg2 n a))))))
	    (Rh1 (+ n -1) (LG1 (+ n -1) (PHI-C2-C1 (+ n -1) (LF2 (+ n -1) (rg2 (+ n -1) (d-h2 n a))))))
	    )))

(defthm lemma-aux-39-bis
  (implies (and (inv-h2 (+ -1 n) a)
		(integerp n))
	   (equal 
	    (Rh1 (+ -1 -1 N) (d-d1 (+ -1 n) (LG1 (+ -1 n) (PHI-C2-C1 (+ -1 n) (LF2 (+ -1 n) (rg2 (+ -1 n) a))))))
	    (Rh1 (+ -1 -1 N) (LG1 (+ -1 -1 N) (PHI-C2-C1 (+ -1 -1 N) (LF2 (+ -1 -1 N) (rg2 (+ -1 -1 N) (d-h2 (+ -1 n) a))))))
	    ))
:hints (("Goal" :use (:instance lemma-aux-39 (n (+ -1 n))))))
  

(defthm inverse-d1-inverse-d1
  (implies (and (inv-d1 n a)
		(integerp n))
	   (equal (inverse-d1 n 
		       (inverse-d1 n a))
		  a)))

(defthm +1-1-1+n
  (equal 
	 (+ 1 -1 -1 n)
	 (+ -1 n))
  :rule-classes nil)


(defthm inverse-d1-inverse-d1-bis
  (implies (and (inv-d1 (+ -1 n) a)
		(integerp n))
	   (equal (inverse-d1 (+ -1 N) 
		       (inverse-d1 (+ 1 -1 -1 N) a))
		  a))
  :hints (("Goal" :use ((:instance +1-1-1+n)
			(:instance inverse-d1-inverse-d1 (n (+ -1 n)))))))


(defthm inv-rh1-lg1-phi-lf2-rg2-dh2
  (implies (and (inv-h2 n a)
		(integerp n))
	   (inv-d1 (+ (+ n -1) 1) (Rh1 (+ n -1) (LG1 (+ n -1) (PHI-C2-C1 (+ n -1) (LF2 (+ n -1) (rg2 (+ n -1) (d-h2 n a))))))))
   :HINTS (("Goal" :IN-THEORY (DISABLE COMMUTATIVITY-OF-+
				       ASSOCIATIVITY-OF-+))))


(defthm inv-rh1-lg1-phi-lf2-rg2-dh2-bis
  (implies (and (inv-h2 (+ -1 N) a)
		(integerp n))
	   (inv-d1 (+ -1 N) (Rh1 (+ -1 -1 n) (LG1 (+ -1 -1 n) (PHI-C2-C1 (+ -1 -1 n) (LF2 (+ -1 -1 n) (rg2 (+ -1 -1 n) (d-h2 (+ -1 n) a))))))))
   :HINTS (("Goal" :use ((:instance inv-rh1-lg1-phi-lf2-rg2-dh2 (n (+ -1 N)))) )))



(defthm lemma-aux-40
  (implies (and (inv-h2 (+ -1 N) a)
		(integerp n))
	   (equal 
	    (INVERSE-D1
      (+ -1 N)
      (INVERSE-D1
           (+ 1 -1 -1 N)
           (RH1 (+ -1 -1 N)
                (LG1 (+ -1 -1 N)
                     (PHI-C2-C1 (+ -1 -1 N)
                                (LF2 (+ -1 -1 N)
                                     (RG2 (+ -1 -1 N)
                                          (D-H2 (+ -1 N) a))))))))
	    (RH1 (+ -1 -1 N)
                (LG1 (+ -1 -1 N)
                     (PHI-C2-C1 (+ -1 -1 N)
                                (LF2 (+ -1 -1 N)
                                     (RG2 (+ -1 -1 N)
                                          (D-H2 (+ -1 N) a)))))	    
	    
	    )))
  :hints (("Goal" 
	   :use ((:instance inv-rh1-lg1-phi-lf2-rg2-dh2-bis)
		 (:instance inverse-d1-inverse-d1-bis
			    (a (RH1 (+ -1 -1 N)
                (LG1 (+ -1 -1 N)
                     (PHI-C2-C1 (+ -1 -1 N)
                                (LF2 (+ -1 -1 N)
                                     (RG2 (+ -1 -1 N)
                                          (D-H2 (+ -1 N) a)))))	    
	    
	    )))))))


(defthm lemma-aux-41
  (implies (and (inv-h2 (+ -1 N) a)
		(integerp n))
	   (equal 
	    (INVERSE-D1
      (+ -1 N)
      (INVERSE-D1
           (+ 1 -1 -1 N)
           (RH1 (+ -1 -1 N)
                (LG1 (+ -1 -1 N)
                     (PHI-C2-C1 (+ -1 -1 N)
                                (LF2 (+ -1 -1 N)
                                     (RG2 (+ -1 -1 N)
                                          (D-H2 (+ -1 N) a))))))))
	    (RH1 (+ -1 -1 N)
		 (d-d1 (+ -1 N)
                (LG1 (+ -1 N)
                     (PHI-C2-C1 (+ -1 N)
                                (LF2 (+ -1 N)
                                     (RG2  (+ -1 N) a))))))))
  :hints (("Goal" 
	   :use ((:instance lemma-aux-40)
		 (:instance lemma-aux-39-bis)))))




(defthm lemma-aux-42
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (EQUAL
                   (GROUP-OPERATION-D1 N (RH1 (1- N) (D-D1 N GNRT))
                                       (D-D1 (1+ N) (RH1 N GNRT)))
                   (GROUP-OPERATION-D1 N GNRT
                                       (INVERSE-D1 N (RG1 N (RF1 N GNRT)))))
	   )
   )


(defthm lemma-aux-43
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (EQUAL  (group-operation-d1 n
                   (GROUP-OPERATION-D1 N (RH1 (1- N) (D-D1 N GNRT))
                                       (D-D1 (1+ N) (RH1 N GNRT)))
		   (inverse-d1 n (D-D1 (1+ N) (RH1 N GNRT))))
		   (group-operation-d1 n
				       (GROUP-OPERATION-D1 N GNRT
							   (INVERSE-D1 N (RG1 N (RF1 N GNRT))))
				       (inverse-d1 n (D-D1 (1+ N) (RH1 N GNRT)))))
	   )
   )


(defthm group-operation-inverse-d1
  (implies (and (inv-d1 n a)
		(inv-d1 n b)
		(integerp n))
	   (equal (group-operation-d1 n (group-operation-d1 n a b)
				      (inverse-d1 n b))
		  a))
  :hints (("Goal" :use ((:instance help3  (c (inverse-d1 n b)))))))
		  



(defthm inv-d-d1-rh1
  (implies (and (inv-d1 n a)
		(integerp n))
	   (inv-d1 (+ (+ n 1) -1) (d-d1 (+ n 1) (rh1 n a))))
  :hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+
				      ASSOCIATIVITY-OF-+))))


(defthm inv-d-d1-rh1-bis
  (implies (and (inv-d1 n a)
		(integerp n))
	   (inv-d1 n (d-d1 (+ n 1) (rh1 n a))))
  :hints (("Goal"  :use ((:instance inv-d-d1-rh1)
		 (:instance +n+1-1)))))




(defthm inv-rh1-d-d1
  (implies (and (inv-d1 n a)
		(integerp n))
	   (inv-d1 (+ (+ n -1) 1) (rh1 (+ n -1) (d-d1 n a))))
  :hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+
				      ASSOCIATIVITY-OF-+))))


(defthm inv-rh1-d-d1-bis
  (implies (and (inv-d1 n a)
		(integerp n))
	   (inv-d1 n (rh1 (+ n -1) (d-d1 n a))))
  :hints (("Goal"  :use ((:instance inv-rh1-d-d1)
		 (:instance ++-1+n-1-2)))))


(defthm lemma-aux-44a
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (EQUAL  (group-operation-d1 n
                   (GROUP-OPERATION-D1 N (RH1 (1- N) (D-D1 N GNRT))
                                       (D-D1 (1+ N) (RH1 N GNRT)))
		   (inverse-d1 n (D-D1 (1+ N) (RH1 N GNRT))))
		   (RH1 (1- N) (D-D1 N GNRT))))
  :hints (("Goal"
	   :use ((:instance inv-rh1-d-d1-bis (a gnrt))
			 (:instance inv-d-d1-rh1-bis (a gnrt))
			 (:instance group-operation-inverse-d1 
				    (a (RH1 (1- N) (D-D1 N GNRT)))
				    (b (D-D1 (1+ N) (RH1 N GNRT))))))))


(defthm lemma-aux-45
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (EQUAL  (RH1 (1- N) (D-D1 N GNRT))
		   (group-operation-d1 n
				       (GROUP-OPERATION-D1 N GNRT
							   (INVERSE-D1 N (RG1 N (RF1 N GNRT))))
				       (inverse-d1 n (D-D1 (1+ N) (RH1 N GNRT))))
		   )
	   )
   :hints (("Goal" :use ((:instance lemma-aux-43)
			 (:instance lemma-aux-44a)))))



(defthm group-operation-group-operation-d1
  (implies (and (inv-d1 n a)
		(inv-d1 n b)
		(inv-d1 n c)
		(integerp n))
	   (equal (group-operation-d1 n (group-operation-d1 n a b) c)
		  (group-operation-d1 n (group-operation-d1 n a c) b)))
  :hints (("Goal" :use ((:instance group-operation-d1-commutativity (a (group-operation-d2 n a b)) (b c))
			(:instance group-operation-d1-commutativity (a (group-operation-d2 n a c)) (b b))
			(:instance group-operation-d1-commutativity (a a) (b b))
			(:instance group-operation-d1-commutativity (a a) (b c))
			(:instance help3 (a c) (b b) (c a))
			(:instance help3 (a b) (b c) (c a))
			(:instance group-operation-d1-commutativity (a b) (b c))))))


(in-theory (disable  group-operation-group-operation-d1))

(defthm lemma-aux-46
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (EQUAL  (group-operation-d1 n
				       (GROUP-OPERATION-D1 N GNRT
							   (INVERSE-D1 N (RG1 N (RF1 N GNRT))))
				       (inverse-d1 n (D-D1 (1+ N) (RH1 N GNRT))))
		   (group-operation-d1 n
				       (GROUP-OPERATION-D1 N GNRT
							   (inverse-d1 n (D-D1 (1+ N) (RH1 N GNRT))))
				       (INVERSE-D1 N (RG1 N (RF1 N GNRT)))
				       )
		   )
	   )
  :hints (("Goal" :use ((:instance inv-d-d1-rh1-bis (a gnrt))
			(:instance group-operation-group-operation-d1
				   (a gnrt)
				   (b (INVERSE-D1 N (RG1 N (RF1 N GNRT))))
				   (c (inverse-d1 n (D-D1 (1+ N) (RH1 N GNRT)))))))))



(defthm lemma-aux-47
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (EQUAL  (RH1 (1- N) (D-D1 N GNRT))
		   (group-operation-d1 n
				       (GROUP-OPERATION-D1 N GNRT
							   (inverse-d1 n (D-D1 (1+ N) (RH1 N GNRT))))
				       (INVERSE-D1 N (RG1 N (RF1 N GNRT)))
				       )
		   )
	   )
  :hints (("Goal" :use ((:instance lemma-aux-45)
			(:instance lemma-aux-46)
			))))

(defthm lemma-aux-48
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (EQUAL  (group-operation-d1 n (RH1 (1- N) (D-D1 N GNRT))
				       (inverse-d1 n (inverse-D1 N (RG1 N (RF1 N GNRT))))
				       )
		   (group-operation-d1 n
		   (group-operation-d1 n
				       (GROUP-OPERATION-D1 N GNRT
							   (inverse-d1 n (D-D1 (1+ N) (RH1 N GNRT))))
				       (INVERSE-D1 N (RG1 N (RF1 N GNRT)))
				       )
		   (inverse-d1 n (inverse-D1 N (RG1 N (RF1 N GNRT)))))
		   )
	   )
  :hints (("Goal" :use ((:instance lemma-aux-47)))))


(defthm inv-rg1-rf1
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (inv-d1 n (rg1 n (rf1 n gnrt)))))


(defthm inv-inverse-d1-rg1-rf1
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (inv-d1 n (inverse-D1 N (RG1 N (RF1 N GNRT))))))

(defthm inv-group-operationinverse-d1-rg1-rf1
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (inv-d1 n (GROUP-OPERATION-D1 N GNRT
					 (inverse-d1 n (D-D1 (1+ N) (RH1 N GNRT))))))
  :hints (("Goal" :use (:instance inv-d-d1-rh1-bis (a gnrt)))))

(defthm lemma-aux-49
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (EQUAL  
		 (group-operation-d1 n
		   (group-operation-d1 n
				       (GROUP-OPERATION-D1 N GNRT
							   (inverse-d1 n (D-D1 (1+ N) (RH1 N GNRT))))
				       (INVERSE-D1 N (RG1 N (RF1 N GNRT)))
				       )
		   (inverse-d1 n (inverse-D1 N (RG1 N (RF1 N GNRT)))))  
		   (GROUP-OPERATION-D1 N GNRT
				       (inverse-d1 n (D-D1 (1+ N) (RH1 N GNRT))))
		  ))
  :hints (("Goal" :in-theory (disable inverse-d1-inverse-d1
				      help3
				      GROUP-OPERATION-D1-DISTRIVUTIVITY-2
				      )
	   :use ((:instance inv-inverse-d1-rg1-rf1)
		 (:instance inv-group-operationinverse-d1-rg1-rf1)
		 (:instance group-operation-inverse-d1
				   (a (GROUP-OPERATION-D1 N GNRT
							   (inverse-d1 n (D-D1 (1+ N) (RH1 N GNRT)))))
				   (b (INVERSE-D1 N (RG1 N (RF1 N GNRT))))
				   )
			))))


(defthm lemma-aux-50
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (EQUAL (GROUP-OPERATION-D1 N (rh1 (1- N) (d-d1 N GNRT))
                                               (RG1 N (RF1 N GNRT))) 	  	   
		  (GROUP-OPERATION-D1 N GNRT
				       (inverse-d1 n (D-D1 (1+ N) (RH1 N GNRT))))))
  :hints (("Goal" :use ((:instance LEMMA-AUX-47)
			(:instance LEMMA-AUX-49)
			(:instance inverse-d1-inverse-d1 (a (Rg1 N (RF1 N GNRT))) )
			))))


(defthm inv-lg1-phi-lf2-rg2
  (implies (and (inv-h2 n a)
		(integerp n))
	   (inv-d1 n (LG1 n
                              (PHI-C2-C1 n
                                         (LF2 n
                                              (RG2 n a)))))))
	   


(defthm lemma-aux-51
  (implies (and (inv-h2 n a)
		(integerp n))
	   (equal 
	    (GROUP-OPERATION-D1
	     n
	     (LG1 n
		  (PHI-C2-C1 n
			     (LF2 n (RG2 n a))))
	     (INVERSE-D1
              n
              (D-D1 (1+ n)
                    (RH1 n
                         (LG1 n
                              (PHI-C2-C1 n
                                         (LF2 n
                                              (RG2 n a))))))))
	    (group-operation-d1 n
		(rh1 (1- N) (d-d1 N
				  (LG1 n
				       (PHI-C2-C1 n
						  (LF2 n
						       (RG2 n a))))))
		(rg1 n (rf1 n (LG1 n
				       (PHI-C2-C1 n
						  (LF2 n
						       (RG2 n a))))))
		)
	    
	    ))
  :hints (("Goal" 
	   :use ((:instance inv-lg1-phi-lf2-rg2)
		 (:instance lemma-aux-50 (gnrt (LG1 n
		  (PHI-C2-C1 n
			     (LF2 n (RG2 n a))))))))))

(defthm lemma-aux-52
  (implies (and (inv-h2 n a)
		(integerp n))
	   (equal 
	    (GROUP-OPERATION-D1
	     n
	     (LG1 n
		  (PHI-C2-C1 n
			     (LF2 n (RG2 n a))))
	     (INVERSE-D1
              n
              (D-D1 (1+ n)
                    (RH1 n
                         (LG1 n
                              (PHI-C2-C1 n
                                         (LF2 n
                                              (RG2 n a))))))))
	    (group-operation-d1 n
		(rg1 n (rf1 n (LG1 n
				   (PHI-C2-C1 n
					      (LF2 n
						   (RG2 n a))))))
		(rh1 (1- N) (d-d1 N
				  (LG1 n
				       (PHI-C2-C1 n
						  (LF2 n
						       (RG2 n a))))))
		
		)
	    
	    ))
  :hints (("Goal" 
	   :use ((:instance lemma-aux-51)
		 (:instance INV-RH1-D-D1-BIS (a (LG1 n
                              (PHI-C2-C1 n
                                         (LF2 n
                                              (RG2 n a))))))
		 (:instance GROUP-OPERATION-D1-COMMUTATIVITY
			    (b (rg1 n (rf1 n (LG1 n
				       (PHI-C2-C1 n
						  (LF2 n
						       (RG2 n a)))))))
			    (a (rh1 (1- N) (d-d1 N
				  (LG1 n
				       (PHI-C2-C1 n
						  (LF2 n
						       (RG2 n a))))))))))))



(defthm lemma-aux-53
  (implies (and (inv-h2 n a)
		(integerp n))
	   (equal 
	    (GROUP-OPERATION-D1
	     n
	     (LG1 n
		  (PHI-C2-C1 n
			     (LF2 n (RG2 n a))))
	     (INVERSE-D1
              n
              (D-D1 (1+ n)
                    (RH1 n
                         (LG1 n
                              (PHI-C2-C1 n
                                         (LF2 n
                                              (RG2 n a))))))))
	    (group-operation-d1 n
		(rg1 n (rf1 n (LG1 n
				   (PHI-C2-C1 n
					      (LF2 n
						   (RG2 n a))))))
		(RH1 (+ N -1)
                        (LG1 (+ N -1)
                             (PHI-C2-C1 (+ N -1)
                                        (LF2 (+ N -1)
                                             (RG2 (+ N -1) (D-H2 N A))))))
		)
	    
	    ))
  :hints (("Goal" 
	   :use ((:instance lemma-aux-39)
		 (:instance lemma-aux-52)		 
		 ))))





(defthm lemma-aux-54
  (implies (and (inv-h2 (+ n -1) a)
		(integerp n))
	   (equal 
	    (GROUP-OPERATION-D1
	     (+ n -1)
	     (LG1 (+ n -1)
		  (PHI-C2-C1 (+ n -1)
			     (LF2 (+ n -1) (RG2 (+ n -1) a))))
	     (INVERSE-D1
              (+ n -1)
              (D-D1 (1+ (+ n -1))
                    (RH1 (+ n -1)
                         (LG1 (+ n -1)
                              (PHI-C2-C1 (+ n -1)
                                         (LF2 (+ n -1)
                                              (RG2 (+ n -1) a))))))))
	    (group-operation-d1 (+ n -1)
		(rg1 (+ n -1) (rf1 (+ n -1) (LG1 (+ n -1)
				   (PHI-C2-C1 (+ n -1)
					      (LF2 (+ n -1)
						   (RG2 (+ n -1) a))))))
		(RH1 (+ (+ n -1) -1)
                        (LG1 (+ (+ n -1) -1)
                             (PHI-C2-C1 (+ (+ n -1) -1)
                                        (LF2 (+ (+ n -1) -1)
                                             (RG2 (+ (+ n -1) -1) (D-H2 (+ n -1) A))))))
		)
	    
	    ))
  :hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+
				      ASSOCIATIVITY-OF-+)
	   :use ((:instance lemma-aux-53 (n (+ N -1)))
		 
		 ))))



(defthm lemma-aux-54
  (implies (and (inv-h2 (+ n -1) a)
		(integerp n))
	   (equal 
	    (GROUP-OPERATION-D1
	     (+ n -1)
	     (LG1 (+ n -1)
		  (PHI-C2-C1 (+ n -1)
			     (LF2 (+ n -1) (RG2 (+ n -1) a))))
	     (INVERSE-D1
              (+ n -1)
              (D-D1 (1+ (+ n -1))
                    (RH1 (+ n -1)
                         (LG1 (+ n -1)
                              (PHI-C2-C1 (+ n -1)
                                         (LF2 (+ n -1)
                                              (RG2 (+ n -1) a))))))))
	    (group-operation-d1 (+ n -1)
		(rg1 (+ n -1) (rf1 (+ n -1) (LG1 (+ n -1)
				   (PHI-C2-C1 (+ n -1)
					      (LF2 (+ n -1)
						   (RG2 (+ n -1) a))))))
		(RH1 (+ (+ n -1) -1)
                        (LG1 (+ (+ n -1) -1)
                             (PHI-C2-C1 (+ (+ n -1) -1)
                                        (LF2 (+ (+ n -1) -1)
                                             (RG2 (+ (+ n -1) -1) (D-H2 (+ n -1) A))))))
		)
	    
	    ))
  :hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+
				      ASSOCIATIVITY-OF-+)
	   :use ((:instance lemma-aux-53 (n (+ N -1)))
		 
		 ))))

(defthm lemma-aux-55
  (implies (and (inv-h2 (+ -1 n) a)
		(integerp n))
	   (equal 
	    (GROUP-OPERATION-D1
	     (+ -1 n)
	     (LG1 (+ -1 n)
		  (PHI-C2-C1 (+ -1 n)
			     (LF2 (+ -1 n) (RG2 (+ -1 n) a))))
	     (INVERSE-D1
              (+ -1 n)
              (D-D1 (1+ (+ -1 n))
                    (RH1 (+ -1 n)
                         (LG1 (+ -1 n)
                              (PHI-C2-C1 (+ -1 n)
                                         (LF2 (+ -1 n)
                                              (RG2 (+ -1 n) a))))))))
	    (group-operation-d1 (+ -1 n)
		(rg1 (+ -1 n) (rf1 (+ -1 n) (LG1 (+ -1 n)
				   (PHI-C2-C1 (+ -1 n)
					      (LF2 (+ -1 n)
						   (RG2 (+ -1 n) a))))))
		(RH1 (+ -1 -1 N)
                        (LG1 (+ -1 -1 N)
                             (PHI-C2-C1 (+ -1 -1 N)
                                        (LF2 (+ -1 -1 N)
                                             (RG2 (+ -1 -1 N) (D-H2 (+ -1 n) A))))))
		)
	    
	    ))
  :hints (("Goal" 
	   :use ((:instance lemma-aux-54 )))))

(defthm group-operation-d1-n
  (implies (equal a b)
	   (equal (group-operation-d1 (+ -1 n) (RG1 (+ -1 N) (D-H1 N A1)) a)
		  (group-operation-d1 (+ -1 n) (RG1 (+ -1 N) (D-H1 N A1)) b)
		  )))


(defthm lemma-aux-56 
(IMPLIES
 (AND (INV-H1 N A1)
      (INV-H2 (+ -1 N) A3)
      (INTEGERP N))
 (EQUAL
  (GROUP-OPERATION-D1
   (+ -1 N)
   (RG1 (+ -1 N) (D-H1 N A1))
   (GROUP-OPERATION-D1
	     (+ -1 n)
	     (LG1 (+ -1 n)
		  (PHI-C2-C1 (+ -1 n)
			     (LF2 (+ -1 n) (RG2 (+ -1 n) a3))))
	     (INVERSE-D1
              (+ -1 n)
              (D-D1 (1+ (+ -1 n))
                    (RH1 (+ -1 n)
                         (LG1 (+ -1 n)
                              (PHI-C2-C1 (+ -1 n)
                                         (LF2 (+ -1 n)
                                              (RG2 (+ -1 n) a3)))))))))
  (GROUP-OPERATION-D1
       (+ -1 N)
       (RG1 (+ -1 N) (D-H1 N A1))
       (group-operation-d1 (+ -1 n)
		(rg1 (+ -1 n) (rf1 (+ -1 n) (LG1 (+ -1 n)
				   (PHI-C2-C1 (+ -1 n)
					      (LF2 (+ -1 n)
						   (RG2 (+ -1 n) a3))))))
		(RH1 (+ -1 -1 N)
                        (LG1 (+ -1 -1 N)
                             (PHI-C2-C1 (+ -1 -1 N)
                                        (LF2 (+ -1 -1 N)
                                             (RG2 (+ -1 -1 N) (D-H2 (+ -1 n) A3))))))
		))))
:hints (("Goal" 
	 :use 
	 ((:instance lemma-aux-55 (a a3))
	 (:instance group-operation-d1-n
		    (a (GROUP-OPERATION-D1
	     (+ -1 n)
	     (LG1 (+ -1 n)
		  (PHI-C2-C1 (+ -1 n)
			     (LF2 (+ -1 n) (RG2 (+ -1 n) a3))))
	     (INVERSE-D1
              (+ -1 n)
              (D-D1 (1+ (+ -1 n))
                    (RH1 (+ -1 n)
                         (LG1 (+ -1 n)
                              (PHI-C2-C1 (+ -1 n)
                                         (LF2 (+ -1 n)
                                              (RG2 (+ -1 n) a3)))))))))
		    (b (group-operation-d1 (+ -1 n)
		(rg1 (+ -1 n) (rf1 (+ -1 n) (LG1 (+ -1 n)
				   (PHI-C2-C1 (+ -1 n)
					      (LF2 (+ -1 n)
						   (RG2 (+ -1 n) a3))))))
		(RH1 (+ -1 -1 N)
                        (LG1 (+ -1 -1 N)
                             (PHI-C2-C1 (+ -1 -1 N)
                                        (LF2 (+ -1 -1 N)
                                             (RG2 (+ -1 -1 N) (D-H2 (+ -1 n) A3))))))
		)))
	 ))))



(in-theory (disable GROUP-OPERATION-D2-COMMUTATIVITY
		    LEMMA-AUX-19
		    LEMMA-AUX-35
		    LEMMA-AUX-55))

(defthm little-help
  (implies (integerp n)
	   (equal (1+ (+ -1 n))
		  n))
  :rule-classes nil)

(defthm lemma-aux-57
(IMPLIES
 (AND (INV-H1 N A1)
      (INV-H2 (+ -1 N) A3)
      (INTEGERP N))
 (EQUAL
  (GROUP-OPERATION-D1
   (+ -1 N)
   (RG1 (+ -1 N) (D-H1 N A1))
   (GROUP-OPERATION-D1
	     (+ -1 n)
	     (LG1 (+ -1 n)
		  (PHI-C2-C1 (+ -1 n)
			     (LF2 (+ -1 n) (RG2 (+ -1 n) a3))))
	     (INVERSE-D1
              (+ -1 n)
              (D-D1 n
                    (RH1 (+ -1 n)
                         (LG1 (+ -1 n)
                              (PHI-C2-C1 (+ -1 n)
                                         (LF2 (+ -1 n)
                                              (RG2 (+ -1 n) a3)))))))))
  (GROUP-OPERATION-D1
       (+ -1 N)
       (RG1 (+ -1 N) (D-H1 N A1))
       (group-operation-d1 (+ -1 n)
		(rg1 (+ -1 n) (rf1 (+ -1 n) (LG1 (+ -1 n)
				   (PHI-C2-C1 (+ -1 n)
					      (LF2 (+ -1 n)
						   (RG2 (+ -1 n) a3))))))
		(RH1 (+ -1 -1 N)
                        (LG1 (+ -1 -1 N)
                             (PHI-C2-C1 (+ -1 -1 N)
                                        (LF2 (+ -1 -1 N)
                                             (RG2 (+ -1 -1 N) (D-H2 (+ -1 n) A3))))))
		))))
:hints (("Goal" 
	 :use 
	 ((:instance little-help)
	  (:instance lemma-aux-56)	 
	 ))))




;----------------------------------------------------------------------------------------------------

;(include-book "cone-equivalence-help")


(DEFTHM |-1+1-1+N|
  (EQUAL (+ -1 1 -1 N) (+ -1 N))
  :RULE-CLASSES NIL)

(DEFTHM
  INVERSE-D2-INVERSE-D2-BIS
  (IMPLIES (AND (INV-D2 (+ -1 N) A) (INTEGERP N))
	   (EQUAL (INVERSE-D2 (+ -1 1 -1 N)
			      (INVERSE-D2 (+ -1 N) A))
		  A))
  :HINTS
  (("Goal"
    :USE ((:INSTANCE |-1+1-1+N|)
	  (:INSTANCE INVERSE-D2-INVERSE-D2 (N (+ -1 N)))))))



(defthm inverse-d2-d-d2-inverse-d-d2
  (implies (AND (INV-D2 n A) (INTEGERP N))
	   (equal (d-d2 n (inverse-d2 n a))
		  (inverse-d2 (+ n -1) (d-d2 n a)))))

(DEFTHM |-1+1+N|
  (implies (integerp n)
	   (EQUAL (+ -1 1 N) n))
  :RULE-CLASSES NIL)


(DEFTHM |-1-1+1+N|
  (EQUAL (+ -1 -1 1 N) (+ -1 N))
  :RULE-CLASSES NIL)

(DEFTHM
  INVERSE-D2-INVERSE-D2-BIS2
  (IMPLIES (AND (INV-D2 (+ -1 N) A) (INTEGERP N))
	   (EQUAL (INVERSE-D2 (+ -1 -1 1 N)
			      (INVERSE-D2 (+ -1 N) A))
		  A))
  :HINTS
  (("Goal"
    :USE ((:INSTANCE |-1-1+1+N|)
	  (:INSTANCE INVERSE-D2-INVERSE-D2 (N (+ -1 N)))))))


(defthm inverse-d2-d-d2-inverse-d-d2-bis
  (implies (AND (INV-D2 n A) (INTEGERP N))
	   (equal (d-d2 (+ -1 1 N) (inverse-d2 n a))
		  (inverse-d2 (+ n -1) (d-d2 n a))))
  :hints (("Goal" 
	   :use 
	   ((:instance |-1+1+N|)
	    (:instance inverse-d2-d-d2-inverse-d-d2)))))


(defthm inv-d-d2-rh2-bis2
  (IMPLIES (AND (INV-D2 (+ -1 n) A) (INTEGERP N))
	   (INV-D2 (+ -1 n)
		   (D-D2 n (RH2 (+ -1 n) A))))
  :hints (("Goal" :use ((:instance inv-d-d2-rh2-bis
				  (n (+ -1 n)))
			(:instance |-1+1+N|)))))

(defthm reduction-property-d2
  (IMPLIES (AND (INV-D2 N GNRT) (INTEGERP N))
            (EQUAL (GROUP-OPERATION-D2 N (RH2 (1- n) (D-D2 N GNRT))
                                       (D-D2 (1+ n) (RH2 N GNRT)))
                   (GROUP-OPERATION-D2 N GNRT
                                       (INVERSE-D2 N (RG2 N (RF2 N GNRT))))))
  
  :hints (("Goal" :in-theory (disable  COMMUTATIVITY-OF-+)
	   :use (:instance |HOMOTOPY-EQUIVALENCE-2-is-an-homotopy-equivalence|))))

(DEFTHM INV-RH2-D-D2-BIS2
  (IMPLIES (AND (INV-D2 N A) (INTEGERP N))
	   (INV-D2 N (RH2 (+ -1 N) (D-D2 N A))))
  :HINTS (("Goal" :USE ((:INSTANCE INV-RH2-D-D2)
			(:INSTANCE |++-1+N-1-2|)))))

(DEFTHM INV-D-D2-RH2-BIS3
  (IMPLIES (AND (INV-D2 N A) (INTEGERP N))
	   (INV-D2 N (D-D2 (+ 1 N) (RH2 N A))))
  :HINTS (("Goal" :USE ((:INSTANCE INV-D-D2-RH2)
			(:INSTANCE |+N+1-1|)))))

(defthm reduction-property-d2-bis
  (IMPLIES (AND (INV-D2 N GNRT) (INTEGERP N))
            (EQUAL (GROUP-OPERATION-D2 N (D-D2 (1+ n) (RH2 N GNRT))
				       (RH2 (1- n) (D-D2 N GNRT))
                                       )
                   (GROUP-OPERATION-D2 N GNRT
                                       (INVERSE-D2 N (RG2 N (RF2 N GNRT))))))
  
  :hints (("Goal" :in-theory (disable  COMMUTATIVITY-OF-+)
	   :use ((:instance reduction-property-d2)
		 (:instance inv-rh2-d-d2-bis2)
		 (:instance inv-d-d2-rh2-bis3)
		 (:instance group-operation-d2-commutativity
			    (a (RH2 (1- n) (D-D2 N GNRT)))
			    (b (D-D2 (1+ n) (RH2 N GNRT))))))))


(defthm reduction-property-d2-bis-2
  (IMPLIES (AND (INV-D2 (+ -1 N) GNRT) (INTEGERP N))
            (EQUAL (GROUP-OPERATION-D2 (+ -1 N) (D-D2 (1+ (+ -1 N)) (RH2 (+ -1 N) GNRT))
				       (RH2 (1- (+ -1 N)) (D-D2 (+ -1 N) GNRT))
                                       )
                   (GROUP-OPERATION-D2 (+ -1 N) GNRT
                                       (INVERSE-D2 (+ -1 N) (RG2 (+ -1 N) (RF2 (+ -1 N) GNRT))))))
  
  :hints (("Goal" :in-theory (disable  COMMUTATIVITY-OF-+)
	   :use ((:instance reduction-property-d2-bis
			    (n (+ -1 n)))))))


(DEFTHM +-1-1+N
  (EQUAL (1- (+ -1 N)) (+ -1 -1 N))
  :RULE-CLASSES NIL)

(DEFTHM +1-1+N
  (IMPLIES (INTEGERP N)
	   (EQUAL (+ 1 -1 N) N))
  :RULE-CLASSES NIL)


(defthm +-1+1+n
  (implies (integerp n)
	   (equal (+ 1 -1 n)
		  n))
  :rule-classes nil)

(defthm ++1-1+n
  (implies (integerp n)
	   (equal (+ -1 1 n)
		  n))
  :rule-classes nil)


(defthm reduction-property-d2-bis-3
  (IMPLIES (AND (INV-D2 (+ -1 N) GNRT) (INTEGERP N))
            (EQUAL (GROUP-OPERATION-D2 (+ -1 N) (D-D2 n (RH2 (+ -1 N) GNRT))
				       (RH2 (+ -1 -1 N) (D-D2 (+ -1 N) GNRT))
                                       )
                   (GROUP-OPERATION-D2 (+ -1 N) GNRT
                                       (INVERSE-D2 (+ -1 N) (RG2 (+ -1 N) (RF2 (+ -1 N) GNRT))))))
  
  :hints (("Goal" :in-theory (disable  COMMUTATIVITY-OF-+)
	   :use ((:instance  +-1-1+n)
		 (:instance +1-1+n)
		 (:instance reduction-property-d2-bis-2)))))


;----------------------------------------------------------------------------------------------------
;----------------------------------------------------------------------------------------------------





(defthm lemma-aux-58
  (implies (and (inv-d1 n (car gnrt))
		(inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
	   (equal (GROUP-OPERATION-D1
   N
   (GROUP-OPERATION-D1
    (+ 1 -1 N)
    (GROUP-OPERATION-D1
     (+ 1 -1 N)
     (GROUP-OPERATION-D1
       N
       (INVERSE-D1 N (RG1 N (RF1 N (CAR GNRT))))
       (GROUP-OPERATION-D1 N (CAR GNRT)
                           (INVERSE-D1 N (D-D1 (+ 1 N) (RH1 N (CAR GNRT))))))
     (RH1 (+ -1 N)
          (LG1 (+ -1 N)
               (PHI-C2-C1 (+ -1 N)
                          (LF2 (+ -1 N) (CADR GNRT))))))
    (INVERSE-D1
         (+ 1 -1 N)
         (RH1 (+ -1 N)
              (LG1 (+ -1 N)
                   (PHI-C2-C1 (+ -1 N)
                              (LF2 (+ -1 N)
                                   (RH2 (+ -1 -1 N)
                                        (D-D2 (+ -1 N) (CADR GNRT)))))))))
   (GROUP-OPERATION-D1
    (+ -1 1 N)
    (D-D1 (+ 1 N) (RH1 N (CAR GNRT)))
    (GROUP-OPERATION-D1
         (+ -1 1 N)
         (LG1 (+ -1 1 N)
              (PHI-C2-C1 (+ -1 1 N)
                         (LF2 (+ -1 1 N)
                              (INVERSE-D2 N (RH2 (+ -1 N) (CADR GNRT))))))
         (D-D1 (+ 1 N)
               (RH1 N
                    (LG1 N
                         (PHI-C2-C1 N
                                    (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))))

		  

		  (GROUP-OPERATION-D1
   N
   (GROUP-OPERATION-D1
    n
    (GROUP-OPERATION-D1
     n
     (GROUP-OPERATION-D1
       N
       (INVERSE-D1 N (RG1 N (RF1 N (CAR GNRT))))
       (GROUP-OPERATION-D1 N (CAR GNRT)
                           (INVERSE-D1 N (D-D1 (+ 1 N) (RH1 N (CAR GNRT))))))
     (RH1 (+ -1 N)
          (LG1 (+ -1 N)
               (PHI-C2-C1 (+ -1 N)
                          (LF2 (+ -1 N) (CADR GNRT))))))
    (INVERSE-D1
         n
         (RH1 (+ -1 N)
              (LG1 (+ -1 N)
                   (PHI-C2-C1 (+ -1 N)
                              (LF2 (+ -1 N)
                                   (RH2 (+ -1 -1 N)
                                        (D-D2 (+ -1 N) (CADR GNRT)))))))))
   (GROUP-OPERATION-D1
    n
    (D-D1 (+ 1 N) (RH1 N (CAR GNRT)))
    (GROUP-OPERATION-D1
         n
         (LG1 n
              (PHI-C2-C1 n
                         (LF2 n
                              (INVERSE-D2 N (RH2 (+ -1 N) (CADR GNRT))))))
         (D-D1 (+ 1 N)
               (RH1 N
                    (LG1 N
                         (PHI-C2-C1 N
                                    (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))))

))
:hints (("Goal" :use ((:instance +-1+1+n)
		      (:instance ++1-1+n)))))
	    


(defthm group-operation-d1-group-operation-d1
  (implies (and (inv-d1 n a1)
		(inv-d1 n a2)
		(inv-d1 n a3)
		(integerp n))
	   (equal (group-operation-d1 n a1 (group-operation-d1 n a2 a3))
		  (group-operation-d1 n a2 (group-operation-d1 n a1 a3))
		  )))



(defthm lemma-aux-59
  (IMPLIES
 (AND (EQUAL (GROUP-OPERATION-D1 N A3
                                 (GROUP-OPERATION-D1 N A6 (INVERSE-D1 N A3)))
             A6)
      (INV-D1 N A1)
      (INV-D1 N A2)
      (INV-D1 N A3)
      (INV-D1 N A4)
      (INV-D1 N A5)
      (INV-D1 N A6)
      (INTEGERP N))
 (EQUAL
  (GROUP-OPERATION-D1
   N A1
   (GROUP-OPERATION-D1
    N A2
    (GROUP-OPERATION-D1
     N A3
     (GROUP-OPERATION-D1
         N A4
         (GROUP-OPERATION-D1 N A5
                             (GROUP-OPERATION-D1 N A6 (INVERSE-D1 N A3)))))))
 (GROUP-OPERATION-D1
   N A1
   (GROUP-OPERATION-D1
    N A2
    (GROUP-OPERATION-D1
     N A4
     (GROUP-OPERATION-D1
         N A5
         a6)))) ))
 :hints (("Goal'"
	   :use ((:instance group-operation-d1-group-operation-d1
			    (a1 a3)
			    (a2 a4)
			    (a3 (GROUP-OPERATION-D1 N A5
                             (GROUP-OPERATION-D1 N A6 (INVERSE-D1 N A3)))))
		 (:instance group-operation-d1-group-operation-d1
			    (a1 a3)
			    (a2 a5)
			    (a3 (GROUP-OPERATION-D1 N A6 (INVERSE-D1 N A3))))))))


(defthm lemma-aux-60
  (implies (and (inv-d1 n a1)
		(inv-d1 n a2)
		(inv-d1 n a3)
		(inv-d1 n a4)
		(inv-d1 n a5)
		(inv-d1 n a6)		
		(integerp n))
	   (equal (group-operation-d1 n (group-operation-d1 n (group-operation-d1 n 
                  (group-operation-d1 n a1 (group-operation-d1 n a2 (inverse-d1 n a3)))
		  a4) a5) (group-operation-d1 n a3 a6))
		  (group-operation-d1 n a1 (group-operation-d1 n a2
		  (group-operation-d1 n a4
                  (group-operation-d1 n a5 a6))))))
 :hints (("Goal'"
	   :use ((:instance group-operation-d1-group-operation-d1
			    (a1 a3)
			    (a2 a4)
			    (a3 (GROUP-OPERATION-D1 N A5
                             (GROUP-OPERATION-D1 N A6 (INVERSE-D1 N A3)))))
		 (:instance group-operation-d1-group-operation-d1
			    (a1 a3)
			    (a2 a5)
			    (a3 (GROUP-OPERATION-D1 N A6 (INVERSE-D1 N A3))))
		 (:instance group-operation-d1-group-operation-d1
			    (a1 a3)
			    (a2 a6)
			    (a3 (INVERSE-D1 N A3)))))))
		  

(defthm inv-inverse-rg1-rf1
  (implies (and (inv-d1 n (car gnrt))
		(integerp n))
	   (inv-d1 n (INVERSE-D1 N (RG1 N (RF1 N (CAR GNRT)))))))


(defthm inv-d1-rh1-lg1-phi-lf2
  (implies (and (inv-d2 n (cadr gnrt))
		(integerp n))
	   (inv-d1 (+ n 1) (RH1 n
			  (LG1 n
			       (PHI-C2-C1 n
					  (LF2 n (CADR GNRT)))))
		   )))

(defthm rule
  (implies (integerp n)
	   (equal (+ (+ -1 N) 1)
		  n))
  :rule-classes nil)

(defthm inv-d1-rh1-lg1-phi-lf2-bis
  (implies (and (inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
	   (inv-d1 n (RH1 (+ -1 N)
			  (LG1 (+ -1 N)
			       (PHI-C2-C1 (+ -1 N)
					  (LF2 (+ -1 N) (CADR GNRT)))))
		   ))
  :hints (("Goal"
	   :use ((:instance inv-d1-rh1-lg1-phi-lf2 (n (+ -1 n)))
		 (:instance rule)))))


(defthm inv-d1-rh1-lg1-phi-lf2-rh2-d-d2
  (implies (and (inv-d2 n (cadr gnrt))
		(integerp n))
	   (inv-d1 (+ (+ (+ N -1) 1) 1) (INVERSE-D1 (+ (+ (+ N -1) 1) 1) (RH1 (+ (+ N -1) 1)  (LG1 (+ (+ N -1)  1)
		      (PHI-C2-C1 (+ (+ N -1) 1)
				 (LF2 (+ (+ N -1) 1)
				      (RH2 (+ N -1)
					   (D-D2 n (CADR GNRT))))))))))
  :hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+
				      ASSOCIATIVITY-OF-+))))


(defthm rule1
  (implies (integerp n)
	   (equal (+ (+ -1 N) -1)
		  (+ -1 -1 N)))
  :rule-classes nil)

(defthm rule2
  (implies (integerp n)
	   (equal (+ (+ (+ -1 N) -1) 1)
		  (+ -1 N)))
  :rule-classes nil)
	   
(defthm rule3
  (implies (integerp n)
	   (equal (+ (+ (+ (+ -1 N) -1) 1) 1)
		  n))
  :rule-classes nil)

(defthm inv-d1-rh1-lg1-phi-lf2-rh2-d-d2-bis
  (implies (and (inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
	   (inv-d1 n (INVERSE-D1 n (RH1 (+ -1 N)  (LG1 (+ -1 N)
		      (PHI-C2-C1 (+ -1 N)
				 (LF2 (+ -1 N)
				      (RH2 (+ -1 -1 N)
					   (D-D2 (+ -1 N) (CADR GNRT))))))))))
  :hints (("Goal"
	   :use ((:instance inv-d1-rh1-lg1-phi-lf2-rh2-d-d2 (n (+ -1 n)))
		 (:instance rule1)
		 (:instance rule2)
		 (:instance rule3)))))

(defthm rule5
  (implies (integerp n)
	   (equal (+ (+ (+ N 1) 1) -1)
		 (+ n 1) ))
  :rule-classes nil)




(defthm inv-group-operation-d1-of-two-terms
    (implies (and (inv-d2 n (cadr gnrt))
		(integerp n))
(inv-d1 (+ n 1) (GROUP-OPERATION-D1
 (+ n 1)
 (LG1 (+ n 1)
      (PHI-C2-C1 (+ n 1)
		 (LF2 (+ n 1)
		      (INVERSE-D2 (+ n 1) (RH2 n (CADR GNRT))))))
 (D-D1 (+ (+ N 1) 1)
       (RH1 (+ n 1)
	    (LG1 (+ n 1)
		 (PHI-C2-C1 (+ n 1)
			    (LF2 (+ n 1) (RH2 n (CADR GNRT))))))))))
:hints (("Goal"  :in-theory (disable COMMUTATIVITY-OF-+
				      ASSOCIATIVITY-OF-+)
	 :use (:instance rule5))))


(defthm rule6
  (implies (integerp n)
	   (equal (+ (+ -1 N) 1)
		  n))
  :rule-classes nil)


(defthm rule7
  (implies (integerp n)
	   (equal (+ (+ (+ -1 N) 1) 1)
		  (+ 1 N)))
  :rule-classes nil)
	   

(defthm inv-group-operation-d1-of-two-terms-bis
    (implies (and (inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
(inv-d1 n (GROUP-OPERATION-D1
 n
 (LG1 n
      (PHI-C2-C1 n
		 (LF2 n
		      (INVERSE-D2 N (RH2 (+ -1 N) (CADR GNRT))))))
 (D-D1 (+ 1 N)
       (RH1 N
	    (LG1 N
		 (PHI-C2-C1 N
			    (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))))

 :hints (("Goal"
	   :use ((:instance inv-group-operation-d1-of-two-terms (n (+ -1 n)))
		 (:instance rule6)
		 (:instance rule7)
		 ))))

(in-theory (disable INV-INVERSE-RG1-RF1
		    inv-d1-rh1-lg1-phi-lf2
		    inv-d1-rh1-lg1-phi-lf2-rh2-d-d2
		    inv-group-operation-d1-of-two-terms
		    inv-d1-rh1-lg1-phi-lf2-bis
		    inv-d1-rh1-lg1-phi-lf2-rh2-d-d2-bis
		    inv-group-operation-d1-of-two-terms-bis))
			


(defthm lemma-aux-61
  (implies (and (inv-d1 n (car gnrt))
		(inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
	  (equal (GROUP-OPERATION-D1
   N
   (GROUP-OPERATION-D1
    n
    (GROUP-OPERATION-D1
     n
     (GROUP-OPERATION-D1
       N
       (INVERSE-D1 N (RG1 N (RF1 N (CAR GNRT))))
       (GROUP-OPERATION-D1 N (CAR GNRT)
                           (INVERSE-D1 N (D-D1 (+ 1 N) (RH1 N (CAR GNRT))))))
     (RH1 (+ -1 N)
          (LG1 (+ -1 N)
               (PHI-C2-C1 (+ -1 N)
                          (LF2 (+ -1 N) (CADR GNRT))))))
    (INVERSE-D1
         n
         (RH1 (+ -1 N)
              (LG1 (+ -1 N)
                   (PHI-C2-C1 (+ -1 N)
                              (LF2 (+ -1 N)
                                   (RH2 (+ -1 -1 N)
                                        (D-D2 (+ -1 N) (CADR GNRT)))))))))
   (GROUP-OPERATION-D1
    n
    (D-D1 (+ 1 N) (RH1 N (CAR GNRT)))
    (GROUP-OPERATION-D1
         n
         (INVERSE-D1 N
                     (LG1 N
                          (PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))
         (D-D1 (+ 1 N)
               (RH1 N
                    (LG1 N
                         (PHI-C2-C1 N
                                    (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))))




	  (group-operation-d1 n (INVERSE-D1 N (RG1 N (RF1 N (CAR GNRT))))
			      (group-operation-d1 n (CAR GNRT)
		  (group-operation-d1 n (RH1 (+ -1 N)
          (LG1 (+ -1 N)
               (PHI-C2-C1 (+ -1 N)
                          (LF2 (+ -1 N) (CADR GNRT)))))
                  (group-operation-d1 n (INVERSE-D1
         n
         (RH1 (+ -1 N)
              (LG1 (+ -1 N)
                   (PHI-C2-C1 (+ -1 N)
                              (LF2 (+ -1 N)
                                   (RH2 (+ -1 -1 N)
                                        (D-D2 (+ -1 N) (CADR GNRT))))))))
				(GROUP-OPERATION-D1
         n
	 (INVERSE-D1 N
                     (LG1 N
                          (PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))
         (D-D1 (+ 1 N)
               (RH1 N
                    (LG1 N
                         (PHI-C2-C1 N
                                    (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))      
				      ))))))
	  :hints (("Goal" :use ((:instance INV-INVERSE-RG1-RF1)
				(:instance inv-d-d1-rh1-bis (a (car gnrt)))
				(:instance inv-d1-rh1-lg1-phi-lf2-bis)
				(:instance inv-d1-rh1-lg1-phi-lf2-rh2-d-d2-bis)
				(:instance inv-group-operation-d1-of-two-terms-bis)
				(:instance lemma-aux-60
					   (a1 (INVERSE-D1 N (RG1 N (RF1 N (CAR GNRT)))))
					   (a2 (CAR GNRT))
					   (a3 (D-D1 (+ 1 N) (RH1 N (CAR GNRT))))
					   (a4 (RH1 (+ -1 N)
						    (LG1 (+ -1 N)
							 (PHI-C2-C1 (+ -1 N)
								    (LF2 (+ -1 N) (CADR GNRT))))))
					   (a5 (INVERSE-D1
						n
						(RH1 (+ -1 N)
						     (LG1 (+ -1 N)
							  (PHI-C2-C1 (+ -1 N)
								     (LF2 (+ -1 N)
									  (RH2 (+ -1 -1 N)
									       (D-D2 (+ -1 N) (CADR GNRT)))))))))
					   (a6 (GROUP-OPERATION-D1
						n
						(INVERSE-D1 N
							    (LG1 N
								 (PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))
						
						(D-D1 (+ 1 N)
						      (RH1 N
							   (LG1 N
								(PHI-C2-C1 N
									   (LF2 N (RH2 (+ -1 N) (CADR GNRT)))))))))))))
)





(defthm lemma-aux-62
  (implies (and (inv-d1 n (car gnrt))
		(inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
	  (equal (group-operation-d1 n (INVERSE-D1 N (RG1 N (RF1 N (CAR GNRT))))
			      (group-operation-d1 n (CAR GNRT)
		  (group-operation-d1 n (RH1 (+ -1 N)
					     (LG1 (+ -1 N)
						  (PHI-C2-C1 (+ -1 N)
							     (LF2 (+ -1 N) (CADR GNRT)))))
				      (group-operation-d1 n (INVERSE-D1
							     n
							     (RH1 (+ -1 N)
								  (LG1 (+ -1 N)
								       (PHI-C2-C1 (+ -1 N)
										  (LF2 (+ -1 N)
										       (RH2 (+ -1 -1 N)
											    (D-D2 (+ -1 N) (CADR GNRT))))))))
							  (GROUP-OPERATION-D1
							   n
							   (INVERSE-D1 N
								       (LG1 N
									    (PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))
							   (D-D1 (+ 1 N)
								 (RH1 N
								      (LG1 N
									   (PHI-C2-C1 N
										      (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))      
							  ))))
		 (group-operation-d1 n (INVERSE-D1 N (RG1 N (RF1 N (CAR GNRT))))
			      (group-operation-d1 n (CAR GNRT)
		  (group-operation-d1 n (group-operation-d1 n (RH1 (+ -1 N)
					     (LG1 (+ -1 N)
						  (PHI-C2-C1 (+ -1 N)
							     (LF2 (+ -1 N) (CADR GNRT)))))
				      (INVERSE-D1
				       n
				       (RH1 (+ -1 N)
					    (LG1 (+ -1 N)
						 (PHI-C2-C1 (+ -1 N)
							    (LF2 (+ -1 N)
								 (RH2 (+ -1 -1 N)
								      (D-D2 (+ -1 N) (CADR GNRT)))))))))
				      (GROUP-OPERATION-D1
				       n
				       (INVERSE-D1 N
						   (LG1 N
							(PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))
				       (D-D1 (+ 1 N)
					     (RH1 N
						  (LG1 N
						       (PHI-C2-C1 N
								  (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))
				      )))))
		 :hints (("Goal" :use (
				
				(:instance inv-d1-rh1-lg1-phi-lf2-bis)
				(:instance inv-d1-rh1-lg1-phi-lf2-rh2-d-d2-bis)
				(:instance inv-group-operation-d1-of-two-terms-bis)
				(:instance help3
					   (a (RH1 (+ -1 N)
					     (LG1 (+ -1 N)
						  (PHI-C2-C1 (+ -1 N)
							     (LF2 (+ -1 N) (CADR GNRT))))))
					   (b (INVERSE-D1
				       n
				       (RH1 (+ -1 N)
					    (LG1 (+ -1 N)
						 (PHI-C2-C1 (+ -1 N)
							    (LF2 (+ -1 N)
								 (RH2 (+ -1 -1 N)
								      (D-D2 (+ -1 N) (CADR GNRT)))))))))
					   (c (GROUP-OPERATION-D1
				       n
				       (INVERSE-D1 N
						   (LG1 N
							(PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))
				       (D-D1 (+ 1 N)
					     (RH1 N
						  (LG1 N
						       (PHI-C2-C1 N
								  (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))))))))



(defthm lemma-aux-63
  (implies (and (inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
   (equal 
   (group-operation-d1 n (RH1 (+ -1 N)
			      (LG1 (+ -1 N)
				   (PHI-C2-C1 (+ -1 N)
					      (LF2 (+ -1 N) (CADR GNRT)))))
		       (INVERSE-D1
			n
			(RH1 (+ -1 N)
			     (LG1 (+ -1 N)
				  (PHI-C2-C1 (+ -1 N)
					     (LF2 (+ -1 N)
						  (RH2 (+ -1 -1 N)
						       (D-D2 (+ -1 N) (CADR GNRT)))))))))
   (group-operation-d1 n (RH1 (+ -1 N)
			      (LG1 (+ -1 N)
				   (PHI-C2-C1 (+ -1 N)
					      (LF2 (+ -1 N) (CADR GNRT)))))
		       (RH1 (+ -1 N)
			     (LG1 (+ -1 N)
				  (PHI-C2-C1 (+ -1 N)
					     (LF2 (+ -1 N)
						  (inverse-d2 (+ -1 N)
						  (RH2 (+ -1 -1 N)
						       (D-D2 (+ -1 N) (CADR GNRT)))))))))))
  :hints (("Goal" :use (:instance +1-1+n))))



(defthm lemma-aux-64
  (implies (and (inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
   (equal 
    (group-operation-d1 n (RH1 (+ -1 N)
			       (LG1 (+ -1 N)
				    (PHI-C2-C1 (+ -1 N)
					       (LF2 (+ -1 N) (CADR GNRT)))))
			(RH1 (+ -1 N)
			     (LG1 (+ -1 N)
				  (PHI-C2-C1 (+ -1 N)
					     (LF2 (+ -1 N)
						  (inverse-d2 (+ -1 N)
							      (RH2 (+ -1 -1 N)
								   (D-D2 (+ -1 N) (CADR GNRT)))))))))
    (RH1 (+ -1 N)
	 (LG1 (+ -1 N)
	      (PHI-C2-C1 (+ -1 N)
			 (LF2 (+ -1 N)
			      (group-operation-d2 (+ -1 N)
						  (CADR GNRT)
						  (inverse-d2 (+ -1 N)
							      (RH2 (+ -1 -1 N)
								   (D-D2 (+ -1 N) (CADR GNRT))))))))))
  ):hints (("Goal" :in-theory (disable lemma-aux-63)
	    :use (:instance +1-1+n))))



(defthm lemma-aux-65
  (implies (and (inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
   (equal 
    (RH1 (+ -1 N)
	 (LG1 (+ -1 N)
	      (PHI-C2-C1 (+ -1 N)
			 (LF2 (+ -1 N)
			      (group-operation-d2 (+ -1 N)
						  (CADR GNRT)
						  (inverse-d2 (+ -1 N)
							      (RH2 (+ -1 -1 N)
								   (D-D2 (+ -1 N) (CADR GNRT)))))))))
    (RH1 (+ -1 N)
	 (LG1 (+ -1 N)
	      (PHI-C2-C1 (+ -1 N)
			 (LF2 (+ -1 N)
			      (group-operation-d2 (+ -1 N) (D-D2 (+ (+ -1 N) 1) (RH2 (+ -1 N) (CADR GNRT)))
				       (RG2 (+ -1 N) (RF2 (+ -1 N) (CADR GNRT)))
				       )
			      )))))
  ):hints (("Goal" :in-theory (disable lemma-aux-63
				       lemma-aux-64
				       INV-INVERSE-D2
				       INV-LG1-PHI-C2-C1-LF2
				       INV-PHI-C2-C1
				       INV-RH2-2
				       INV-LG1 INV-LF2
				       INV-RH2-D-D2-BIS2)
	    :use ((:instance lemma-aux-30 (n (+ -1 N))
			    (gnrt (cadr gnrt)))
		  (:instance  +1-1+n)))))



(defthm inv-rg2-rf2
  (implies (and (inv-d2 n a)
		(integerp n))
	   (inv-d2 n (rg2 n (rf2 n a)))))


(defthm inv-rg2-rf2-bis
  (implies (and (inv-d2 (+ -1 n) a)
		(integerp n))
	   (inv-d2 (+ -1 n) (rg2 (+ -1 n) (rf2 (+ -1 n) a))))
  :hints (("Goal" :use (:instance inv-rg2-rf2 (n (+ -1 n))))))


(defthm inv-d-d2-rh2-b3
  (implies (and (inv-d2 (+ -1 n) a)
		(integerp n))
	   (inv-d2 (+ -1 n) (D-D2 (+ (+ -1 N) 1) (RH2 (+ -1 N) a))))
  :hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+
				      ASSOCIATIVITY-OF-+)
	   :use ((:instance INV-D-D2-RH2-BIS2)
			(:instance rule6)))))

(defthm lemma-aux-66
  (implies (and (inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
   (equal 
    (group-operation-d1 n 
			(RH1 (+ -1 N)
			     (LG1 (+ -1 N)
				  (PHI-C2-C1 (+ -1 N)
					     (LF2 (+ -1 N) (D-D2 (+ (+ -1 N) 1) (RH2 (+ -1 N) (CADR GNRT)))))))
			(RH1 (+ -1 N)
			     (LG1 (+ -1 N)
				  (PHI-C2-C1 (+ -1 N)
					     (LF2 (+ -1 N)
						  (RG2 (+ -1 N) (RF2 (+ -1 N) (CADR GNRT))))))))
    (RH1 (+ -1 N)
	 (LG1 (+ -1 N)
	      (PHI-C2-C1 (+ -1 N)
			 (LF2 (+ -1 N)
			      (group-operation-d2 (+ -1 N) (D-D2 (+ (+ -1 N) 1) (RH2 (+ -1 N) (CADR GNRT)))
						  (RG2 (+ -1 N) (RF2 (+ -1 N) (CADR GNRT)))
						  )))))
     ))
     :hints (("Goal" :in-theory (disable lemma-aux-63
					 LEMMA-AUX-30
					 COMMUTATIVITY-OF-+
					 ASSOCIATIVITY-OF-+)
	    :use (:instance rule6))))



(defthm lemma-aux-67
  (implies (and (inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
	   (equal (group-operation-d1 n (RH1 (+ -1 N)
			       (LG1 (+ -1 N)
				    (PHI-C2-C1 (+ -1 N)
					       (LF2 (+ -1 N) (CADR GNRT)))))
			(RH1 (+ -1 N)
			     (LG1 (+ -1 N)
				  (PHI-C2-C1 (+ -1 N)
					     (LF2 (+ -1 N)
						  (inverse-d2 (+ -1 N)
							      (RH2 (+ -1 -1 N)
								   (D-D2 (+ -1 N) (CADR GNRT)))))))))
	   (group-operation-d1 n 
			(RH1 (+ -1 N)
			     (LG1 (+ -1 N)
				  (PHI-C2-C1 (+ -1 N)
					     (LF2 (+ -1 N) (D-D2 (+ (+ -1 N) 1) (RH2 (+ -1 N) (CADR GNRT)))))))
			(RH1 (+ -1 N)
			     (LG1 (+ -1 N)
				  (PHI-C2-C1 (+ -1 N)
					     (LF2 (+ -1 N)
						  (RG2 (+ -1 N) (RF2 (+ -1 N) (CADR GNRT))))))))
))
:hints (("Goal" :use ((:instance lemma-aux-64)
		      (:instance lemma-aux-65)
		      (:instance lemma-aux-66))))
)


(defthm lemma-aux-68
  (implies (and (inv-d2 n a)
		(integerp n))
	   (equal (RH1 (- (+ n 1) 1)
			     (LG1 (- (+ n 1) 1)
				  (PHI-C2-C1 (- (+ n 1) 1)
					     (LF2 (- (+ n 1) 1) (D-D2 (+ n 1) (RH2 n a))))))
		  (RH1 (- (+ n 1) 1)
		       (d-d1 (+ n 1)
			     (LG1 (+ n 1)
				  (PHI-C2-C1 (+ n 1)
					     (LF2 (+ n 1) (RH2 n a)))))
)))
:hints (("Goal" :in-theory (disable  COMMUTATIVITY-OF-+
			    lemma-aux-27
			    lemma-aux-26
			    lemma-aux-25))))



(defthm lemma-aux-68-b
  (implies (and (inv-d2 (+ -1 n) a)
		(integerp n))
	   (equal (RH1 (+ -1 n)
			     (LG1 (+ -1 n)
				  (PHI-C2-C1 (+ -1 n)
					     (LF2 (+ -1 n) (D-D2 n (RH2 (+ -1 n) a))))))
		  (RH1 (+ -1 n)
		       (d-d1 n
			     (LG1 n
				  (PHI-C2-C1 n
					     (LF2 n (RH2 (+ -1 n) a)))))
)))
:hints (("Goal" :use ((:instance lemma-aux-68 (n (+ -1 n)))))))


(defthm lemma-aux-67-b
  (implies (and (inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
	   (equal (group-operation-d1 n (RH1 (+ -1 N)
			       (LG1 (+ -1 N)
				    (PHI-C2-C1 (+ -1 N)
					       (LF2 (+ -1 N) (CADR GNRT)))))
			(RH1 (+ -1 N)
			     (LG1 (+ -1 N)
				  (PHI-C2-C1 (+ -1 N)
					     (LF2 (+ -1 N)
						  (inverse-d2 (+ -1 N)
							      (RH2 (+ -1 -1 N)
								   (D-D2 (+ -1 N) (CADR GNRT)))))))))
	   (group-operation-d1 n 
			(RH1 (+ -1 N)
			     (LG1 (+ -1 N)
				  (PHI-C2-C1 (+ -1 N)
					     (LF2 (+ -1 N) (D-D2 n (RH2 (+ -1 N) (CADR GNRT)))))))
			(RH1 (+ -1 N)
			     (LG1 (+ -1 N)
				  (PHI-C2-C1 (+ -1 N)
					     (LF2 (+ -1 N)
						  (RG2 (+ -1 N) (RF2 (+ -1 N) (CADR GNRT))))))))
))
:hints (("Goal" :in-theory (disable LEMMA-AUX-68-B)
	 :use ((:instance lemma-aux-67)
		      (:instance rule6)
		      )))
)



(defthm lemma-aux-69
  (implies (and (inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
	   (equal (group-operation-d1 n (RH1 (+ -1 N)
			       (LG1 (+ -1 N)
				    (PHI-C2-C1 (+ -1 N)
					       (LF2 (+ -1 N) (CADR GNRT)))))
			(RH1 (+ -1 N)
			     (LG1 (+ -1 N)
				  (PHI-C2-C1 (+ -1 N)
					     (LF2 (+ -1 N)
						  (inverse-d2 (+ -1 N)
							      (RH2 (+ -1 -1 N)
								   (D-D2 (+ -1 N) (CADR GNRT)))))))))
	   (group-operation-d1 n 
			(RH1 (+ -1 n)
		       (d-d1 n
			     (LG1 n
				  (PHI-C2-C1 n
					     (LF2 n (RH2 (+ -1 n) (CADR GNRT)))))))
			(RH1 (+ -1 N)
			     (LG1 (+ -1 N)
				  (PHI-C2-C1 (+ -1 N)
					     (LF2 (+ -1 N)
						  (RG2 (+ -1 N) (RF2 (+ -1 N) (CADR GNRT))))))))
))
:hints (("Goal" :in-theory (disable lemma-aux-68-b)
	 :use ((:instance lemma-aux-67-b)
	       (:instance lemma-aux-68-b (a (cadr gnrt)))
		      )))
)

(in-theory (disable lemma-aux-68-b))


(defthm lemma-aux-70
    (implies (and (inv-d1 n (car gnrt))
		(inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
  (equal (group-operation-d1 n (INVERSE-D1 N (RG1 N (RF1 N (CAR GNRT))))
			      (group-operation-d1 n (CAR GNRT)
		  (group-operation-d1 n (group-operation-d1 n (RH1 (+ -1 N)
					     (LG1 (+ -1 N)
						  (PHI-C2-C1 (+ -1 N)
							     (LF2 (+ -1 N) (CADR GNRT)))))
				      (INVERSE-D1
				       n
				       (RH1 (+ -1 N)
					    (LG1 (+ -1 N)
						 (PHI-C2-C1 (+ -1 N)
							    (LF2 (+ -1 N)
								 (RH2 (+ -1 -1 N)
								      (D-D2 (+ -1 N) (CADR GNRT)))))))))
				      (GROUP-OPERATION-D1
				       n
				       (INVERSE-D1 N
						   (LG1 N
							(PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))
				       (D-D1 (+ 1 N)
					     (RH1 N
						  (LG1 N
						       (PHI-C2-C1 N
								  (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))
				      )))
	 (group-operation-d1 n (INVERSE-D1 N (RG1 N (RF1 N (CAR GNRT))))
			      (group-operation-d1 n (CAR GNRT)
		  (group-operation-d1 n (group-operation-d1 n 
							    (RH1 (+ -1 n)
								 (d-d1 n
								       (LG1 n
									    (PHI-C2-C1 n
										       (LF2 n (RH2 (+ -1 n) (CADR GNRT)))))))
							    (RH1 (+ -1 N)
								 (LG1 (+ -1 N)
								      (PHI-C2-C1 (+ -1 N)
										 (LF2 (+ -1 N)
										      (RG2 (+ -1 N) (RF2 (+ -1 N) (CADR GNRT))))))))
				      (GROUP-OPERATION-D1
				       n
				       (INVERSE-D1 N
						   (LG1 N
							(PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))
				       (D-D1 (+ 1 N)
					     (RH1 N
						  (LG1 N
						       (PHI-C2-C1 N
								  (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))
				      )))))
    :hints (("Goal" :use (:instance lemma-aux-69)))
    )





(defthm lemma-aux-43-b
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (EQUAL  (group-operation-d1 n
                   (GROUP-OPERATION-D1 N (RH1 (1- N) (D-D1 N GNRT))
                                       (D-D1 (1+ N) (RH1 N GNRT)))
		   (inverse-d1 n (RH1 (1- N) (D-D1 N GNRT))))
		   (group-operation-d1 n
				       (GROUP-OPERATION-D1 N GNRT
							   (INVERSE-D1 N (RG1 N (RF1 N GNRT))))
				       (inverse-d1 n (RH1 (1- N) (D-D1 N GNRT)))))
	   )
   :hints (("Goal" :in-theory (disable LEMMA-AUX-47
				       LEMMA-AUX-46
				       LEMMA-AUX-45))))





(defthm lemma-aux-44-b
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (EQUAL  (group-operation-d1 n
                   (GROUP-OPERATION-D1 N (RH1 (1- N) (D-D1 N GNRT))
                                       (D-D1 (1+ N) (RH1 N GNRT)))
		   (inverse-d1 n (RH1 (1- N) (D-D1 N GNRT))))
		   (D-D1 (1+ N) (RH1 N GNRT))))
  :hints (("Goal" :in-theory (disable LEMMA-AUX-47
				      LEMMA-AUX-46
				      LEMMA-AUX-45)
	   :use ((:instance inv-rh1-d-d1-bis (a gnrt))
			 (:instance inv-d-d1-rh1-bis (a gnrt))
			 (:instance group-operation-d1-commutativity
				    (b (D-D1 (1+ N) (RH1 N GNRT)))
				    (a (RH1 (1- N) (D-D1 N GNRT))))
			 (:instance group-operation-inverse-d1 
				    (a (D-D1 (1+ N) (RH1 N GNRT)))
				    (b (RH1 (1- N) (D-D1 N GNRT))))))))


(defthm lemma-aux-45-b
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (EQUAL  (D-D1 (1+ N) (RH1 N GNRT))
		   (group-operation-d1 n
				       (GROUP-OPERATION-D1 N GNRT
							   (INVERSE-D1 N (RG1 N (RF1 N GNRT))))
				       (inverse-d1 n (RH1 (1- N) (D-D1 N GNRT))))
		   )
	   )
   :hints (("Goal" :use ((:instance lemma-aux-43-b)
			 (:instance lemma-aux-44-b)))))



(defthm lemma-aux-46-b
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (EQUAL  (group-operation-d1 n
				       (GROUP-OPERATION-D1 N GNRT
							   (INVERSE-D1 N (RG1 N (RF1 N GNRT))))
				       (inverse-d1 n (RH1 (1- N) (D-D1 N GNRT))))
		   (group-operation-d1 n
				       (GROUP-OPERATION-D1 N (INVERSE-D1 N (RG1 N (RF1 N GNRT)))
							   (inverse-d1 n (RH1 (1- N) (D-D1 N GNRT)))
							   )
				       gnrt
				       )
		   )
	   )
  :hints (("Goal" :in-theory (disable LEMMA-AUX-47
				      LEMMA-AUX-46
				      LEMMA-AUX-45
				      LEMMA-AUX-45-b)	   
	   :use ((:instance inv-rh1-d-d1-bis (a gnrt))
		 (:instance group-operation-c1-commutativity
			    (a gnrt)
			    (b (INVERSE-D1 N (RG1 N (RF1 N GNRT)))))
		 (:instance group-operation-group-operation-d1
			    (b gnrt)
			    (a (INVERSE-D1 N (RG1 N (RF1 N GNRT))))
			    (c (inverse-d1 n (RH1 (1- N) (D-D1 N GNRT)))))))))



(defthm lemma-aux-47-b
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (EQUAL  (D-D1 (1+ N) (RH1 N GNRT))
		   (group-operation-d1 n
				       (GROUP-OPERATION-D1 N (INVERSE-D1 N (RG1 N (RF1 N GNRT)))
							   (inverse-d1 n (RH1 (1- N) (D-D1 N GNRT)))
							   )
				       gnrt
				       )
		   )
	   )
  :hints (("Goal" :in-theory (disable LEMMA-AUX-47
				      LEMMA-AUX-46
				      LEMMA-AUX-45
				      LEMMA-AUX-45-b)
	   :use ((:instance lemma-aux-45-b)
			(:instance lemma-aux-46-b)
			))))

(defthm lemma-aux-48-b
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (EQUAL  (group-operation-d1 n (D-D1 (1+ N) (RH1 N GNRT))
				       (inverse-d1 n gnrt)
				       )
		   (group-operation-d1 n
		   (group-operation-d1 n
				       (GROUP-OPERATION-D1 N (INVERSE-D1 N (RG1 N (RF1 N GNRT)))
							   (inverse-d1 n (RH1 (1- N) (D-D1 N GNRT)))
							   )
				       gnrt
				       )
		   (inverse-d1 n gnrt))
		   )
	   )
  :hints (("Goal" :in-theory (disable LEMMA-AUX-47
				      LEMMA-AUX-46
				      LEMMA-AUX-45
				      LEMMA-AUX-45-b)
	   :use ((:instance lemma-aux-47-b)))))


(in-theory (disable LEMMA-AUX-47
		    LEMMA-AUX-46
		    LEMMA-AUX-45
		    LEMMA-AUX-45-b))









(defthm inv-group-operationinverse-d1-rg1-rf1-b
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (inv-d1 n (GROUP-OPERATION-D1 N (INVERSE-D1 N (RG1 N (RF1 N GNRT)))
					 (inverse-d1 n (RH1 (1- N) (D-D1 N GNRT)))
					 )))
  :hints (("Goal" :use (:instance inv-rh1-d-d1-bis (a gnrt)))))

(defthm lemma-aux-49-b
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (EQUAL  (group-operation-d1 n
		   (group-operation-d1 n
				       (GROUP-OPERATION-D1 N (INVERSE-D1 N (RG1 N (RF1 N GNRT)))
							   (inverse-d1 n (RH1 (1- N) (D-D1 N GNRT)))
							   )
				       gnrt
				       )
		   (inverse-d1 n gnrt))
		   (GROUP-OPERATION-D1 N (INVERSE-D1 N (RG1 N (RF1 N GNRT)))
							   (inverse-d1 n (RH1 (1- N) (D-D1 N GNRT)))
							   )	   
		  ))
  :hints (("Goal" :in-theory (disable inverse-d1-inverse-d1
				      help3
				      GROUP-OPERATION-D1-DISTRIVUTIVITY-2
				      LEMMA-AUX-47
				      LEMMA-AUX-46
				      LEMMA-AUX-45
				      LEMMA-AUX-45-b)
	   :use (
		 (:instance inv-group-operationinverse-d1-rg1-rf1-b)
		 (:instance group-operation-inverse-d1
				   (a (GROUP-OPERATION-D1 N (INVERSE-D1 N (RG1 N (RF1 N GNRT)))
							   (inverse-d1 n (RH1 (1- N) (D-D1 N GNRT)))
							   ))
				   (b gnrt)
				   )
			))))


(defthm lemma-aux-50-b
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (EQUAL  (group-operation-d1 n (D-D1 (1+ N) (RH1 N GNRT))
				       (inverse-d1 n gnrt)
				       )	  	   
		   (GROUP-OPERATION-D1 N (INVERSE-D1 N (RG1 N (RF1 N GNRT)))
							   (inverse-d1 n (RH1 (1- N) (D-D1 N GNRT)))
							   )))
  :hints (("Goal" :use ((:instance LEMMA-AUX-48-b)
			(:instance LEMMA-AUX-49-b)			
			))))

(defthm lemma-aux-50-b2
  (implies (and (inv-d1 n gnrt)
		(integerp n))
	   (EQUAL  (group-operation-d1 n 
				       (inverse-d1 n gnrt)
				       (D-D1 (1+ N) (RH1 N GNRT)))	  	   
		   (GROUP-OPERATION-D1 N (INVERSE-D1 N (RG1 N (RF1 N GNRT)))
							   (inverse-d1 n (RH1 (1- N) (D-D1 N GNRT)))
							   )))
  :hints (("Goal" :use ((:instance LEMMA-AUX-48-b)
			(:instance LEMMA-AUX-49-b)			
			))))







(defthm lemma-aux-72
  (implies (and (inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
	   (equal(GROUP-OPERATION-D1
	    n
	    (INVERSE-D1 N
			(LG1 N
			     (PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))
	    (D-D1 (+ 1 N)
		  (RH1 N
		       (LG1 N
			    (PHI-C2-C1 N
				       (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))
		 (GROUP-OPERATION-D1
	    n
	    (INVERSE-D1 N (rg1 n (rf1 n
			(LG1 N
			     (PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))
	    (inverse-d1 n (rh1 (+ -1 N)
		  (d-d1 N
		       (LG1 N
			    (PHI-C2-C1 N
				       (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))

	   )))
  :hints (("Goal" :in-theory (disable lemma-aux-47-b)
	   :use ((:instance lemma-aux-50-b2
			    (gnrt (LG1 N
			     (PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT)))))))))))



;; Importante lemma-aux-70 para concatenarlo

(defthm lemma-aux-73
    (implies (and (inv-d1 n (car gnrt))
		(inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
  (equal (group-operation-d1 n (INVERSE-D1 N (RG1 N (RF1 N (CAR GNRT))))
			      (group-operation-d1 n (CAR GNRT)
		  (group-operation-d1 n (group-operation-d1 n 
							    (RH1 (+ -1 n)
								 (d-d1 n
								       (LG1 n
									    (PHI-C2-C1 n
										       (LF2 n (RH2 (+ -1 n) (CADR GNRT)))))))
							    (RH1 (+ -1 N)
								 (LG1 (+ -1 N)
								      (PHI-C2-C1 (+ -1 N)
										 (LF2 (+ -1 N)
										      (RG2 (+ -1 N) (RF2 (+ -1 N) (CADR GNRT))))))))
				      (GROUP-OPERATION-D1
				       n
				       (INVERSE-D1 N
						   (LG1 N
							(PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))
				       (D-D1 (+ 1 N)
					     (RH1 N
						  (LG1 N
						       (PHI-C2-C1 N
								  (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))
				      )))
	 (group-operation-d1 n (INVERSE-D1 N (RG1 N (RF1 N (CAR GNRT))))
			      (group-operation-d1 n (CAR GNRT)
		  (group-operation-d1 n (group-operation-d1 n 
							    (RH1 (+ -1 n)
								 (d-d1 n
								       (LG1 n
									    (PHI-C2-C1 n
										       (LF2 n (RH2 (+ -1 n) (CADR GNRT)))))))
							    (RH1 (+ -1 N)
								 (LG1 (+ -1 N)
								      (PHI-C2-C1 (+ -1 N)
										 (LF2 (+ -1 N)
										      (RG2 (+ -1 N) (RF2 (+ -1 N) (CADR GNRT))))))))
				      (GROUP-OPERATION-D1
				       n
				       (INVERSE-D1 N (rg1 n (rf1 n
								 (LG1 N
								      (PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))
				       (inverse-d1 n (rh1 (+ -1 N)
							  (d-d1 N
								(LG1 N
								     (PHI-C2-C1 N
										(LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))
				       
				       )
				      )))
	 
	 ))
    :hints (("Goal" :use (:instance lemma-aux-72)))
    )



(defthm lemma-aux-74
  (implies (and (inv-d1 n a)
		(inv-d1 n b)
		(inv-d1 n c)
		(integerp n))
	   (equal (group-operation-d1 n (group-operation-d1 n a b)
				      (group-operation-d1 n c (inverse-d1 n a)))
		  (group-operation-d1 n b c)))
  :hints (("Goal" :use
	   ((:instance group-operation-d1-commutativity (a c)
		       (b (INVERSE-D1 N A)))
	    (:instance  help3
			(a (group-operation-d1 n a b))
			(b (INVERSE-D1 N A))
			(c c))
	    (:instance group-operation-d1-commutativity (a a)
		       (b b))
	    (:instance  help3
			(a b)
			(b a)
			(c (inverse-d1 n a)))
	    ))))



(defthm inv-rh1-d1-term-aux
  (implies (and (inv-d2 n a)
		(integerp n))
	   (inv-d1 (+ n 1)
		   (LG1 (+ n 1)
			    (PHI-C2-C1 (+ n 1)
				       (LF2 (+ n 1) (RH2 n a))))
	    ))
  :HINTS (("Goal" :IN-THEORY (DISABLE COMMUTATIVITY-OF-+
				      ASSOCIATIVITY-OF-+
				      ))))

(defthm inv-rh1-d1-term-aux
  (implies (and (inv-d2 n a)
		(integerp n))
	   (inv-d1 (+ n 1)
		   (LG1 (+ n 1)
			    (PHI-C2-C1 (+ n 1)
				       (LF2 (+ n 1) (RH2 n a))))
	    ))
  :HINTS (("Goal" :IN-THEORY (DISABLE COMMUTATIVITY-OF-+
				      ASSOCIATIVITY-OF-+
				      ))))

(defthm inv-rh1-d1-term-aux2
  (implies (and (inv-d1 n a)
		(integerp n))
	   (inv-d1 (+ (+ n -1) 1)
	    (RH1 (+ n -1)
		 (d-d1 n
		       a))
	    ))
  :HINTS (("Goal" :IN-THEORY (DISABLE COMMUTATIVITY-OF-+
				      ASSOCIATIVITY-OF-+
				      ))))

(defthm inv-rh1-d1-term
  (implies (and (inv-d2 n a)
		(integerp n))
	   (inv-d1 (+ (+ (+ n 1) -1) 1)
	    (RH1 (+ (+ n 1) -1)
		 (d-d1 (+ n 1)
		       (LG1 (+ n 1)
			    (PHI-C2-C1 (+ n 1)
				       (LF2 (+ n 1) (RH2 n a))))))
	    ))
  :hints (("Goal" :IN-THEORY (DISABLE COMMUTATIVITY-OF-+
				      ASSOCIATIVITY-OF-+
				     |HOMOTOPY-EQUIVALENCE-1-is-an-homotopy-equivalence|
				     |HOMOTOPY-EQUIVALENCE-2-is-an-homotopy-equivalence|
				     INV-RH2
				     |PHI-C2-C1-is-a-chain-complex-morphism-of-degree-0|
				      )
	   :use ((:instance inv-rh1-d1-term-aux2 (n (+ n 1)))
		 (:instance inv-rh1-d1-term-aux)
			))))


(defthm inv-rh1-term
  (implies (and (inv-d2 n a)
		(integerp n))
	   (inv-d1 (+ n 1)
		   (RH1 n
			(LG1 n
			     (PHI-C2-C1 n
					(LF2 n
					     (RG2 n (RF2 n a))))))
		   
	    ))
  :hints (("Goal" :IN-THEORY (DISABLE COMMUTATIVITY-OF-+
				      ASSOCIATIVITY-OF-+
				      ))))
	   

(defthm rule8
  (implies (integerp n)
	   (equal (+ (+ (+ n 1) -1) 1)
		  (+ n 1)))
  :rule-classes nil)

(defthm rule9
  (implies (integerp n)
	   (equal (+ (+ n 1) -1)
		  n))
  :rule-classes nil)

(defthm inv-rh1-d1-term-bis
  (implies (and (inv-d2 n a)
		(integerp n))
	   (inv-d1 (+ n 1)
	    (RH1 (+ (+ n 1) -1)
		 (d-d1 (+ n 1)
		       (LG1 (+ n 1)
			    (PHI-C2-C1 (+ n 1)
				       (LF2 (+ n 1) (RH2 n a))))))
	    ))
  :hints (("Goal" :IN-THEORY (DISABLE COMMUTATIVITY-OF-+
				      ASSOCIATIVITY-OF-+
				     |HOMOTOPY-EQUIVALENCE-1-is-an-homotopy-equivalence|
				     |HOMOTOPY-EQUIVALENCE-2-is-an-homotopy-equivalence|
				     INV-RH2
				     |PHI-C2-C1-is-a-chain-complex-morphism-of-degree-0|
				      )
	   :use ((:instance rule8)
		 (:instance rule9)
		 (:instance inv-rh1-d1-term)
		 ))))



(defthm rule10
  (implies (integerp n)
	   (equal (+ (+ (+ -1 n) 1) -1)
		  (+ -1 n)))
  :rule-classes nil)


(defthm inv-rh1-d1-term-bis2
  (implies (and (inv-d2 (+ -1 n)  a)
		(integerp n))
	   (inv-d1 (+ (+ -1 n) 1)
	    (RH1 (+ (+ (+ -1 n) 1) -1)
		 (d-d1 (+ (+ -1 n) 1)
		       (LG1 (+ (+ -1 n) 1)
			    (PHI-C2-C1 (+ (+ -1 n) 1)
				       (LF2 (+ (+ -1 n) 1) (RH2 (+ -1 n) a))))))
	    ))
  :hints (("Goal" :IN-THEORY (DISABLE COMMUTATIVITY-OF-+
				      ASSOCIATIVITY-OF-+
				     |HOMOTOPY-EQUIVALENCE-1-is-an-homotopy-equivalence|
				     |HOMOTOPY-EQUIVALENCE-2-is-an-homotopy-equivalence|
				     INV-RH2
				     |PHI-C2-C1-is-a-chain-complex-morphism-of-degree-0|
				      )
	   :use ((:instance inv-rh1-d1-term-bis (n (+ -1 n)))
		 
		 ))))



(defthm inv-rh1-d1-term-bis3
  (implies (and (inv-d2 (+ -1 n)  a)
		(integerp n))
	   (inv-d1 n
	    (RH1 (+ -1 n)
		 (d-d1 n
		       (LG1 n
			    (PHI-C2-C1 n
				       (LF2 n (RH2 (+ -1 n) a))))))
	    ))
  :hints (("Goal" :IN-THEORY (DISABLE 
				     |HOMOTOPY-EQUIVALENCE-1-is-an-homotopy-equivalence|
				     |HOMOTOPY-EQUIVALENCE-2-is-an-homotopy-equivalence|
				     INV-RH2
				     |PHI-C2-C1-is-a-chain-complex-morphism-of-degree-0|
				      )
	   :use ((:instance inv-rh1-d1-term-bis2 )
		 (:instance rule6)
		 (:instance rule10)
		 ))))



(defthm inv-rh1-term-bis
  (implies (and (inv-d2 (+ -1 n) a)
		(integerp n))
	   (inv-d1 n
		   (RH1 (+ -1 n)
			(LG1 (+ -1 n)
			     (PHI-C2-C1 (+ -1 n)
					(LF2 (+ -1 n)
					     (RG2 (+ -1 n) (RF2 (+ -1 n)  a))))))
		   
	    ))
  :hints (("Goal" :use
	   ((:instance inv-rh1-term (n (+ -1 n)))
	    (:instance rule6)))))


(defthm inv-inverse-term
  (implies (and (inv-d2 n a)
		(integerp n))
	   (inv-d1 (+ n 1)
		   (INVERSE-D1 (+ n 1) (rg1 (+ n 1) (rf1 (+ n 1)
					     (LG1 (+ n 1)
						  (PHI-C2-C1 (+ n 1) (LF2 (+ n 1) (RH2 n a)))))))
		   ))
  :hints (("Goal" :in-theory (disable COMMUTATIVITY-OF-+))))

(defthm inv-inverse-term-bis
  (implies (and (inv-d2 (+ -1 n) a)
		(integerp n))
	   (inv-d1 n
		   (INVERSE-D1 n (rg1 n (rf1 n
					     (LG1 n
						  (PHI-C2-C1 n (LF2 n (RH2 (+ -1 n) a)))))))
		   ))
  :hints (("Goal" :use
	   ((:instance inv-inverse-term (n (+ -1 n)))
	    (:instance rule6)) )))


	   
(defthm lemma-aux-75
    (implies (and (inv-d1 n (car gnrt))
		(inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
  (equal (group-operation-d1 n (INVERSE-D1 N (RG1 N (RF1 N (CAR GNRT))))
			      (group-operation-d1 n (CAR GNRT)
		  (group-operation-d1 n (group-operation-d1 n 
							    (RH1 (+ -1 n)
								 (d-d1 n
								       (LG1 n
									    (PHI-C2-C1 n
										       (LF2 n (RH2 (+ -1 n) (CADR GNRT)))))))
							    (RH1 (+ -1 N)
								 (LG1 (+ -1 N)
								      (PHI-C2-C1 (+ -1 N)
										 (LF2 (+ -1 N)
										      (RG2 (+ -1 N) (RF2 (+ -1 N) (CADR GNRT))))))))
				      (GROUP-OPERATION-D1
				       n
				       (INVERSE-D1 N (rg1 n (rf1 n
								 (LG1 N
								      (PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))
				       (inverse-d1 n (rh1 (+ -1 N)
							  (d-d1 N
								(LG1 N
								     (PHI-C2-C1 N
										(LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))
				       
				       )
				      )))
	 (group-operation-d1 n (INVERSE-D1 N (RG1 N (RF1 N (CAR GNRT))))
			      (group-operation-d1 n (CAR GNRT)
		  (group-operation-d1 n (RH1 (+ -1 N)
					     (LG1 (+ -1 N)
						  (PHI-C2-C1 (+ -1 N)
							     (LF2 (+ -1 N)
								  (RG2 (+ -1 N) (RF2 (+ -1 N) (CADR GNRT)))))))
				      (INVERSE-D1 N (rg1 n (rf1 n
								 (LG1 N
								      (PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))
				      )))))
    :hints (("Goal" :in-theory (disable lemma-aux-47-b
					lemma-aux-72
				       lemma-aux-50-b2)
	     :use ((:instance inv-rh1-d1-term-bis3 (a (cadr gnrt)))
		   (:instance INV-RH1-TERM-BIS (a (cadr gnrt)))
		   (:instance INV-INVERSE-TERM-BIS (a (cadr gnrt)))		
		   (:instance lemma-aux-74
			      (a (RH1 (+ -1 n)
				      (d-d1 n
					    (LG1 n
						 (PHI-C2-C1 n
							    (LF2 n (RH2 (+ -1 n) (CADR GNRT))))))))
			      (b (RH1 (+ -1 N)
				      (LG1 (+ -1 N)
					   (PHI-C2-C1 (+ -1 N)
						      (LF2 (+ -1 N)
							   (RG2 (+ -1 N) (RF2 (+ -1 N) (CADR GNRT))))))))
			      (c (INVERSE-D1 N (rg1 n (rf1 n
							   (LG1 N
								(PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))))))
	    ))




(defthm lemma-aux-76
    (implies (and (inv-d1 n (car gnrt))
		(inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
  (equal (group-operation-d1 n (INVERSE-D1 N (RG1 N (RF1 N (CAR GNRT))))
			      (group-operation-d1 n (CAR GNRT)
		  (group-operation-d1 n (group-operation-d1 n (RH1 (+ -1 N)
					     (LG1 (+ -1 N)
						  (PHI-C2-C1 (+ -1 N)
							     (LF2 (+ -1 N) (CADR GNRT)))))
				      (INVERSE-D1
				       n
				       (RH1 (+ -1 N)
					    (LG1 (+ -1 N)
						 (PHI-C2-C1 (+ -1 N)
							    (LF2 (+ -1 N)
								 (RH2 (+ -1 -1 N)
								      (D-D2 (+ -1 N) (CADR GNRT)))))))))
				      (GROUP-OPERATION-D1
				       n
				       (INVERSE-D1 N
						   (LG1 N
							(PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))
				       (D-D1 (+ 1 N)
					     (RH1 N
						  (LG1 N
						       (PHI-C2-C1 N
								  (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))
				      )))
	 (group-operation-d1 n (INVERSE-D1 N (RG1 N (RF1 N (CAR GNRT))))
			      (group-operation-d1 n (CAR GNRT)
		  (group-operation-d1 n (RH1 (+ -1 N)
					     (LG1 (+ -1 N)
						  (PHI-C2-C1 (+ -1 N)
							     (LF2 (+ -1 N)
								  (RG2 (+ -1 N) (RF2 (+ -1 N) (CADR GNRT)))))))
				      (INVERSE-D1 N (rg1 n (rf1 n
								 (LG1 N
								      (PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))
				      )))))
    :hints (("Goal" :in-theory (disable lemma-aux-47-b
					lemma-aux-72
				       lemma-aux-50-b2)
	     :use ((:instance lemma-aux-70)
		   (:instance lemma-aux-73)
		   (:instance lemma-aux-75))))
	    )













(IN-THEORY (DISABLE INV-INVERSE-RG1-RF1
                               INV-D1-RH1-LG1-PHI-LF2
                               INV-D1-RH1-LG1-PHI-LF2-RH2-D-D2
                               INV-GROUP-OPERATION-D1-OF-TWO-TERMS
                               INV-D1-RH1-LG1-PHI-LF2-BIS
                               INV-D1-RH1-LG1-PHI-LF2-RH2-D-D2-BIS
                               INV-GROUP-OPERATION-D1-OF-TWO-TERMS-BIS
                               LEMMA-AUX-68-B INV-RH1-D1-TERM
                               INV-RH1-D1-TERM-BIS INV-RH1-D1-TERM-BIS2
                               INV-RH1-TERM INV-INVERSE-TERM
                               INV-RH1-D1-TERM-BIS3 INV-RH1-TERM-BIS
                               INV-INVERSE-TERM-BIS LEMMA-AUX-47-B lemma-aux-72 lemma-aux-50-b2 lemma-aux-62 lemma-aux-63))




(in-theory (enable lemma-aux-47
		   lemma-aux-46
		   lemma-aux-45))



(defthm lemma-aux-77
    (implies (and (inv-d1 n (car gnrt))
		(inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
	     (equal (group-operation-d1 n (INVERSE-D1 N (RG1 N (RF1 N (CAR GNRT))))
			      (group-operation-d1 n (CAR GNRT)
						  (group-operation-d1 n (RH1 (+ -1 N)
									     (LG1 (+ -1 N)
										  (PHI-C2-C1 (+ -1 N)
											     (LF2 (+ -1 N)
												  (RG2 (+ -1 N) (RF2 (+ -1 N) (CADR GNRT)))))))
								      (INVERSE-D1 N (rg1 n (rf1 n
												(LG1 N
												     (PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))
				      )))
		    (group-operation-d1 n (INVERSE-D1 N (RG1 N (RF1 N (CAR GNRT))))
			      (group-operation-d1 n (CAR GNRT)
						  (group-operation-d1 n 
								      (INVERSE-D1 N (rg1 n (rf1 n
												(LG1 N
												     (PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))
								      (RH1 (+ -1 N)
									   (LG1 (+ -1 N)
										(PHI-C2-C1 (+ -1 N)
											   (LF2 (+ -1 N)
												(RG2 (+ -1 N) (RF2 (+ -1 N) (CADR GNRT))))))))))))
    :hints (("Goal" :use ((:instance INV-RH1-TERM-BIS (a (cadr gnrt)))
			  (:instance INV-INVERSE-TERM-BIS (a (cadr gnrt)))		
			  (:instance group-operation-d1-commutativity
				     (a (RH1 (+ -1 N)
					     (LG1 (+ -1 N)
						  (PHI-C2-C1 (+ -1 N)
							     (LF2 (+ -1 N)
								  (RG2 (+ -1 N) (RF2 (+ -1 N) (CADR GNRT))))))))
				     (b (INVERSE-D1 N (rg1 n (rf1 n
								  (LG1 N
								       (PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))))))))


(defthm lemma-aux-78
  (implies (and (inv-d1 n a1)
		(inv-d1 n a2)
		(inv-d1 n a3)
		(inv-d1 n a4)
		(integerp n))
	   (equal (group-operation-d1 n (inverse-d1 n a1)
				      (group-operation-d1 n a2
						(group-operation-d1 n (inverse-d1 n a3)
								    a4)))
		  (group-operation-d1 n a2
				      (inverse-d1 n (group-operation-d1 n
									(group-operation-d1 n a1 a3)
									(inverse-d1 n a4)))))))
(in-theory (disable lemma-aux-77))

(defthm lemma-aux-79
  (implies (and (inv-d1 n (car gnrt))
		(inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
	   (equal (group-operation-d1 n (INVERSE-D1 N (RG1 N (RF1 N (CAR GNRT))))
			      (group-operation-d1 n (CAR GNRT)
						  (group-operation-d1 n 
								      (INVERSE-D1 N (rg1 n (rf1 n
												(LG1 N
												     (PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))
								      (RH1 (+ -1 N)
									   (LG1 (+ -1 N)
										(PHI-C2-C1 (+ -1 N)
											   (LF2 (+ -1 N)
												(RG2 (+ -1 N) (RF2 (+ -1 N) (CADR GNRT))))))))))

		  
		 (GROUP-OPERATION-D1
   N (CAR GNRT)
   (INVERSE-D1
    N
    (GROUP-OPERATION-D1
     N
     (GROUP-OPERATION-D1
          N (RG1 N (RF1 N (CAR GNRT)))
          (RG1 N
               (RF1 N
                    (LG1 N
                         (PHI-C2-C1 N
                                    (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))
     (INVERSE-D1
         N
         (RH1 (+ -1 N)
              (LG1 (+ -1 N)
                   (PHI-C2-C1 (+ -1 N)
                              (LF2 (+ -1 N)
                                   (RG2 (+ -1 N)
                                        (RF2 (+ -1 N) (CADR GNRT))))))))))) ))
  :hints (("Goal" :use ((:instance INV-RH1-TERM-BIS (a (cadr gnrt)))
			(:instance lemma-aux-78
				   (a1 (RG1 N (RF1 N (CAR GNRT))))
				   (a2 (CAR GNRT))
				   (a3 (rg1 n (rf1 n
												(LG1 N
												     (PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))
				   (a4 (RH1 (+ -1 N)
              (LG1 (+ -1 N)
                   (PHI-C2-C1 (+ -1 N)
                              (LF2 (+ -1 N)
                                   (RG2 (+ -1 N)
                                        (RF2 (+ -1 N) (CADR GNRT)))))))))))))


(defthm lemma-aux-80
  (implies (and (inv-d1 n (car gnrt))
		(inv-d2 (+ -1 n) (cadr gnrt))
		(integerp n))
	   (equal 
(group-operation-d1 n (INVERSE-D1 N (RG1 N (RF1 N (CAR GNRT))))
			      (group-operation-d1 n (CAR GNRT)
		  (group-operation-d1 n (group-operation-d1 n (RH1 (+ -1 N)
					     (LG1 (+ -1 N)
						  (PHI-C2-C1 (+ -1 N)
							     (LF2 (+ -1 N) (CADR GNRT)))))
				      (INVERSE-D1
				       n
				       (RH1 (+ -1 N)
					    (LG1 (+ -1 N)
						 (PHI-C2-C1 (+ -1 N)
							    (LF2 (+ -1 N)
								 (RH2 (+ -1 -1 N)
								      (D-D2 (+ -1 N) (CADR GNRT)))))))))
				      (GROUP-OPERATION-D1
				       n
				       (INVERSE-D1 N
						   (LG1 N
							(PHI-C2-C1 N (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))
				       (D-D1 (+ 1 N)
					     (RH1 N
						  (LG1 N
						       (PHI-C2-C1 N
								  (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))
				      )))
		  
		 (GROUP-OPERATION-D1
   N (CAR GNRT)
   (INVERSE-D1
    N
    (GROUP-OPERATION-D1
     N
     (GROUP-OPERATION-D1
          N (RG1 N (RF1 N (CAR GNRT)))
          (RG1 N
               (RF1 N
                    (LG1 N
                         (PHI-C2-C1 N
                                    (LF2 N (RH2 (+ -1 N) (CADR GNRT))))))))
     (INVERSE-D1
         N
         (RH1 (+ -1 N)
              (LG1 (+ -1 N)
                   (PHI-C2-C1 (+ -1 N)
                              (LF2 (+ -1 N)
                                   (RG2 (+ -1 N)
                                        (RF2 (+ -1 N) (CADR GNRT))))))))))) ))
  :hints (("Goal" :use ((:instance lemma-aux-76)
			(:instance lemma-aux-77)
			(:instance lemma-aux-79)
			))))



  

(check-heq-p
(heq
 (reduction 
 (chain-complex 
  'inv-ring-Z 'addition-ring-Z 'zero-element-Z 'inverse-Z 'product-ring-Z 'unit-Z 
   'inv-cone-cone-d2-d1 'group-suspension-suspension-operation-D1 'zero-cone-cone-d2-d1 
   'external-cone-cone-d2-d1 'inverse-cone-cone-d2-d1 'd-cone-cone-d2-d1 )
 (chain-complex 
   'inv-ring-Z 'addition-ring-Z 'zero-element-Z 'inverse-Z 'product-ring-Z 'unit-Z
    'inv-cone-cone-c2-c1 'group-operation-cone-cone-c2-c1 'zero-cone-cone-c2-c1 'external-cone-cone-c2-c1 'inverse-cone-cone-c2-c1 'd-cone-cone-c2-c1 )
  'lf-cones  'lg-cones  'lh-cones
  )
 (reduction 
 (chain-complex 
  'inv-ring-Z 'addition-ring-Z 'zero-element-Z 'inverse-Z 'product-ring-Z 'unit-Z 
   'inv-cone-cone-d2-d1 'group-operation-cone-cone-d2-d1 'zero-cone-cone-d2-d1 'external-cone-cone-d2-d1 'inverse-cone-cone-d2-d1 'd-cone-cone-d2-d1 )
 (chain-complex 
   'inv-ring-Z 'addition-ring-Z 'zero-element-Z 'inverse-Z 'product-ring-Z 'unit-Z
    'inv-cone-cone-h2-h1 'group-operation-cone-cone-h2-h1 'zero-cone-cone-h2-h1 'external-cone-cone-h2-h1 'inverse-cone-cone-h2-h1 'd-cone-cone-h2-h1 )
  'rf-cones  'rg-cones  'rh-cones
  ))
'homotopy-equivalence-cones
:hints '(("Subgoal 48" :use ((:instance aux-bis)))
	   ("Subgoal 4" :use ((:instance lemma-aux-62)
			   (:instance lemma-aux-80)))
	   )
   )


;;;===========================================================================
;;;
;;; End of the proof of the Cone Reduction Theorem
;;;
;;;===========================================================================

;;;----------------------------------------------------------------------------
;;; 
;;; Defining the generic theory:
;;;
;;;----------------------------------------------------------------------------


(include-book "generic-theory")


#|
(get-event-lst 
 '(phi-d2-d1
   phi-h2-h1
   inv-cone-cone-c2-c1 group-operation-cone-cone-c2-c1 zero-cone-cone-c2-c1 external-cone-cone-c2-c1 inverse-cone-cone-c2-c1 d-cone-cone-c2-c1
   inv-cone-cone-d2-d1 group-operation-cone-cone-d2-d1 zero-cone-cone-d2-d1 external-cone-cone-d2-d1 inverse-cone-cone-d2-d1 d-cone-cone-d2-d1 
   inv-cone-cone-h2-h1 group-operation-cone-cone-h2-h1 zero-cone-cone-h2-h1 external-cone-cone-h2-h1 inverse-cone-cone-h2-h1 d-cone-cone-h2-h1
   lf-cones
   lg-cones
   lh-cones
   rf-cones
   rg-cones
   rh-cones
   |HOMOTOPY-EQUIVALENCE-CONES-is-an-homotopy-equivalence|
   )
 )
|#


(defconst *cone-reduction-theorem*
  '((DEFUN PHI-D2-D1 (N A)
        (LG1 N (PHI-C2-C1 N (LF2 N A))))
 (DEFUN PHI-H2-H1 (N A)
        (RF1 N (PHI-D2-D1 N (RG2 N A))))
 (DEFUN INV-CONE-CONE-C2-C1 (N A)
        (AND (EQUAL (LIST (CAR A) (CADR A)) A)
             (INV-C1 N (CAR A))
             (INV-C2 (1- N) (CADR A))))
 (DEFUN GROUP-OPERATION-CONE-CONE-C2-C1 (N A B)
        (LIST (GROUP-OPERATION-C1 N (CAR A) (CAR B))
              (GROUP-OPERATION-C2 (1- N)
                                  (CADR A)
                                  (CADR B))))
 (DEFUN ZERO-CONE-CONE-C2-C1 (N)
        (LIST (ZERO-C1 N) (ZERO-C2 (1- N))))
 (DEFUN EXTERNAL-CONE-CONE-C2-C1 (N A B)
        (LIST (EXTERNAL-C1 N A (CAR B))
              (EXTERNAL-C2 (1- N) A (CADR B))))
 (DEFUN INVERSE-CONE-CONE-C2-C1 (N A)
        (LIST (INVERSE-C1 N (CAR A))
              (INVERSE-C2 (1- N) (CADR A))))
 (DEFUN D-CONE-CONE-C2-C1 (N A)
        (LIST (GROUP-OPERATION-C1 (1- N)
                                  (D-C1 N (CAR A))
                                  (PHI-C2-C1 (1- N) (CADR A)))
              (INVERSE-C2 (1- (1- N))
                          (D-C2 (1- N) (CADR A)))))
 (DEFUN INV-CONE-CONE-D2-D1 (N A)
        (AND (EQUAL (LIST (CAR A) (CADR A)) A)
             (INV-D1 N (CAR A))
             (INV-D2 (1- N) (CADR A))))
 (DEFUN GROUP-OPERATION-CONE-CONE-D2-D1 (N A B)
        (LIST (GROUP-OPERATION-D1 N (CAR A) (CAR B))
              (GROUP-OPERATION-D2 (1- N)
                                  (CADR A)
                                  (CADR B))))
 (DEFUN ZERO-CONE-CONE-D2-D1 (N)
        (LIST (ZERO-D1 N) (ZERO-D2 (1- N))))
 (DEFUN EXTERNAL-CONE-CONE-D2-D1 (N A B)
        (LIST (EXTERNAL-D1 N A (CAR B))
              (EXTERNAL-D2 (1- N) A (CADR B))))
 (DEFUN INVERSE-CONE-CONE-D2-D1 (N A)
        (LIST (INVERSE-D1 N (CAR A))
              (INVERSE-D2 (1- N) (CADR A))))
 (DEFUN D-CONE-CONE-D2-D1 (N A)
        (LIST (GROUP-OPERATION-D1 (1- N)
                                  (D-D1 N (CAR A))
                                  (PHI-D2-D1 (1- N) (CADR A)))
              (INVERSE-D2 (1- (1- N))
                          (D-D2 (1- N) (CADR A)))))
 (DEFUN INV-CONE-CONE-H2-H1 (N A)
        (AND (EQUAL (LIST (CAR A) (CADR A)) A)
             (INV-H1 N (CAR A))
             (INV-H2 (1- N) (CADR A))))
 (DEFUN GROUP-OPERATION-CONE-CONE-H2-H1 (N A B)
        (LIST (GROUP-OPERATION-H1 N (CAR A) (CAR B))
              (GROUP-OPERATION-H2 (1- N)
                                  (CADR A)
                                  (CADR B))))
 (DEFUN ZERO-CONE-CONE-H2-H1 (N)
        (LIST (ZERO-H1 N) (ZERO-H2 (1- N))))
 (DEFUN EXTERNAL-CONE-CONE-H2-H1 (N A B)
        (LIST (EXTERNAL-H1 N A (CAR B))
              (EXTERNAL-H2 (1- N) A (CADR B))))
 (DEFUN INVERSE-CONE-CONE-H2-H1 (N A)
        (LIST (INVERSE-H1 N (CAR A))
              (INVERSE-H2 (1- N) (CADR A))))
 (DEFUN D-CONE-CONE-H2-H1 (N A)
        (LIST (GROUP-OPERATION-H1 (1- N)
                                  (D-H1 N (CAR A))
                                  (PHI-H2-H1 (1- N) (CADR A)))
              (INVERSE-H2 (1- (1- N))
                          (D-H2 (1- N) (CADR A)))))
 (DEFUN LF-CONES (N A)
        (LIST (LF1 N (CAR A))
              (LF2 (1- N) (CADR A))))
 (DEFUN LG-CONES (N A)
        (LIST (LG1 N (CAR A))
              (LG2 (1- N) (CADR A))))
 (DEFUN LH-CONES (N A)
        (LIST (LH1 N (CAR A))
              (INVERSE-D2 N (LH2 (1- N) (CADR A)))))
 (DEFUN
      RF-CONES (N A)
      (LIST (GROUP-OPERATION-H1 N (RF1 N (CAR A))
                                (RF1 N (PHI-D2-D1 N (RH2 (1- N) (CADR A)))))
            (RF2 (1- N) (CADR A))))
 (DEFUN
  RG-CONES (N A)
  (LIST
    (GROUP-OPERATION-D1 N (RG1 N (CAR A))
                        (INVERSE-D1 N
                                    (RH1 (1- N)
                                         (PHI-D2-D1 (1- N)
                                                    (RG2 (1- N) (CADR A))))))
    (RG2 (1- N) (CADR A))))
 (DEFUN
      RH-CONES (N A)
      (LIST (GROUP-OPERATION-D1 (1+ N)
                                (RH1 N (CAR A))
                                (RH1 N (PHI-D2-D1 N (RH2 (1- N) (CADR A)))))
            (INVERSE-D2 N (RH2 (1- N) (CADR A)))))
 (DEFTHM
  |HOMOTOPY-EQUIVALENCE-CONES-is-an-homotopy-equivalence|
  (AND
   (AND
    (AND
     (AND
      (AND
       (AND
        (AND
         (AND
            (AND (IMPLIES (AND (INV-RING-Z X) (INV-RING-Z Y))
                          (INV-RING-Z (ADDITION-RING-Z X Y)))
                 (IMPLIES (AND (INV-RING-Z X)
                               (INV-RING-Z Y)
                               (INV-RING-Z Z))
                          (EQUAL (ADDITION-RING-Z (ADDITION-RING-Z X Y)
                                                  Z)
                                 (ADDITION-RING-Z X (ADDITION-RING-Z Y Z)))))
            (IMPLIES (INV-RING-Z X)
                     (EQUAL (ADDITION-RING-Z (ZERO-ELEMENT-Z) X)
                            X))
            (IMPLIES (INV-RING-Z X)
                     (EQUAL (ADDITION-RING-Z X (ZERO-ELEMENT-Z))
                            X))
            (INV-RING-Z (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (EQUAL (ADDITION-RING-Z (INVERSE-Z X) X)
                         (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (EQUAL (ADDITION-RING-Z X (INVERSE-Z X))
                         (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (INV-RING-Z (INVERSE-Z X))))
        (AND (AND (IMPLIES (AND (INV-RING-Z X) (INV-RING-Z Y))
                           (INV-RING-Z (PRODUCT-RING-Z X Y)))
                  (IMPLIES (AND (INV-RING-Z X)
                                (INV-RING-Z Y)
                                (INV-RING-Z Z))
                           (EQUAL (PRODUCT-RING-Z (PRODUCT-RING-Z X Y) Z)
                                  (PRODUCT-RING-Z X (PRODUCT-RING-Z Y Z)))))
             (IMPLIES (INV-RING-Z X)
                      (EQUAL (PRODUCT-RING-Z (UNIT-Z) X) X))
             (IMPLIES (INV-RING-Z X)
                      (EQUAL (PRODUCT-RING-Z X (UNIT-Z)) X))
             (INV-RING-Z (UNIT-Z)))
        (IMPLIES (AND (INV-RING-Z X)
                      (INV-RING-Z Y)
                      (INV-RING-Z Z))
                 (EQUAL (PRODUCT-RING-Z X (ADDITION-RING-Z Y Z))
                        (ADDITION-RING-Z (PRODUCT-RING-Z X Y)
                                         (PRODUCT-RING-Z X Z))))
        (IMPLIES (AND (INV-RING-Z X)
                      (INV-RING-Z Y)
                      (INV-RING-Z Z))
                 (EQUAL (PRODUCT-RING-Z (ADDITION-RING-Z X Y) Z)
                        (ADDITION-RING-Z (PRODUCT-RING-Z X Z)
                                         (PRODUCT-RING-Z Y Z)))))
       (IMPLIES
            (AND (INV-CONE-CONE-D2-D1 N A)
                 (INV-CONE-CONE-D2-D1 N B)
                 (INTEGERP N))
            (INV-CONE-CONE-D2-D1 N
                                 (GROUP-OPERATION-CONE-CONE-D2-D1 N A B)))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INV-CONE-CONE-D2-D1 N B)
                     (INV-CONE-CONE-D2-D1 N C)
                     (INTEGERP N))
                (EQUAL (GROUP-OPERATION-CONE-CONE-D2-D1
                            N
                            (GROUP-OPERATION-CONE-CONE-D2-D1 N A B)
                            C)
                       (GROUP-OPERATION-CONE-CONE-D2-D1
                            N A
                            (GROUP-OPERATION-CONE-CONE-D2-D1 N B C))))
       (INV-CONE-CONE-D2-D1 N (ZERO-CONE-CONE-D2-D1 N))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INV-RING-Z R)
                     (INTEGERP N))
                (INV-CONE-CONE-D2-D1 N (EXTERNAL-CONE-CONE-D2-D1 N R A)))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INTEGERP N))
        (EQUAL (GROUP-OPERATION-CONE-CONE-D2-D1 N A (ZERO-CONE-CONE-D2-D1 N))
               A))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INTEGERP N))
                (INV-CONE-CONE-D2-D1 N (INVERSE-CONE-CONE-D2-D1 N A)))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INV-CONE-CONE-D2-D1 N B)
                     (INTEGERP N)
                     (EQUAL (GROUP-OPERATION-CONE-CONE-D2-D1 N A B)
                            (ZERO-CONE-CONE-D2-D1 N)))
                (EQUAL (INVERSE-CONE-CONE-D2-D1 N A) B))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INTEGERP N))
        (EQUAL
          (GROUP-OPERATION-CONE-CONE-D2-D1 N A (INVERSE-CONE-CONE-D2-D1 N A))
          (ZERO-CONE-CONE-D2-D1 N)))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INV-CONE-CONE-D2-D1 N B)
                     (INTEGERP N))
                (EQUAL (GROUP-OPERATION-CONE-CONE-D2-D1 N A B)
                       (GROUP-OPERATION-CONE-CONE-D2-D1 N B A)))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INV-CONE-CONE-D2-D1 N B)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
         (EXTERNAL-CONE-CONE-D2-D1 N R
                                   (GROUP-OPERATION-CONE-CONE-D2-D1 N A B))
         (GROUP-OPERATION-CONE-CONE-D2-D1 N (EXTERNAL-CONE-CONE-D2-D1 N R A)
                                          (EXTERNAL-CONE-CONE-D2-D1 N R B))))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INV-RING-Z S)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
         (EXTERNAL-CONE-CONE-D2-D1 N (ADDITION-RING-Z S R)
                                   A)
         (GROUP-OPERATION-CONE-CONE-D2-D1 N (EXTERNAL-CONE-CONE-D2-D1 N S A)
                                          (EXTERNAL-CONE-CONE-D2-D1 N R A))))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INV-RING-Z S)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
            (EXTERNAL-CONE-CONE-D2-D1 N (PRODUCT-RING-Z S R)
                                      A)
            (EXTERNAL-CONE-CONE-D2-D1 N S (EXTERNAL-CONE-CONE-D2-D1 N R A))))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INTEGERP N))
                (EQUAL (EXTERNAL-CONE-CONE-D2-D1 N (UNIT-Z) A)
                       A))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INV-CONE-CONE-D2-D1 N B)
             (INTEGERP N))
        (EQUAL
            (INVERSE-CONE-CONE-D2-D1 N
                                     (GROUP-OPERATION-CONE-CONE-D2-D1 N A B))
            (GROUP-OPERATION-CONE-CONE-D2-D1 N (INVERSE-CONE-CONE-D2-D1 N A)
                                             (INVERSE-CONE-CONE-D2-D1 N B))))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INV-RING-Z S)
             (INTEGERP N))
        (EQUAL (INVERSE-CONE-CONE-D2-D1 N (EXTERNAL-CONE-CONE-D2-D1 N S A))
               (EXTERNAL-CONE-CONE-D2-D1 N S (INVERSE-CONE-CONE-D2-D1 N A))))
       (IMPLIES (INTEGERP N)
                (EQUAL (INVERSE-CONE-CONE-D2-D1 N (ZERO-CONE-CONE-D2-D1 N))
                       (ZERO-CONE-CONE-D2-D1 N)))
       (IMPLIES
            (AND (INV-RING-Z S) (INTEGERP N))
            (EQUAL (EXTERNAL-CONE-CONE-D2-D1 N S (ZERO-CONE-CONE-D2-D1 N))
                   (ZERO-CONE-CONE-D2-D1 N))))
      (AND
       (AND
        (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                      (INTEGERP N))
                 (INV-CONE-CONE-D2-D1 (+ N -1)
                                      (D-CONE-CONE-D2-D1 N A)))
        (IMPLIES
           (AND (INV-CONE-CONE-D2-D1 N A)
                (INV-CONE-CONE-D2-D1 N B)
                (INTEGERP N))
           (EQUAL (D-CONE-CONE-D2-D1 N
                                     (GROUP-OPERATION-CONE-CONE-D2-D1 N A B))
                  (GROUP-OPERATION-CONE-CONE-D2-D1 (+ N -1)
                                                   (D-CONE-CONE-D2-D1 N A)
                                                   (D-CONE-CONE-D2-D1 N B))))
        (IMPLIES
             (AND (INV-CONE-CONE-D2-D1 N A)
                  (INV-RING-Z R)
                  (INTEGERP N))
             (EQUAL (D-CONE-CONE-D2-D1 N (EXTERNAL-CONE-CONE-D2-D1 N R A))
                    (EXTERNAL-CONE-CONE-D2-D1 (+ N -1)
                                              R (D-CONE-CONE-D2-D1 N A))))
        (IMPLIES (INTEGERP N)
                 (EQUAL (D-CONE-CONE-D2-D1 N (ZERO-CONE-CONE-D2-D1 N))
                        (ZERO-CONE-CONE-D2-D1 (+ N -1))))
        (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                      (INTEGERP N))
                 (EQUAL (D-CONE-CONE-D2-D1 N (INVERSE-CONE-CONE-D2-D1 N A))
                        (INVERSE-CONE-CONE-D2-D1 (+ N -1)
                                                 (D-CONE-CONE-D2-D1 N A)))))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INTEGERP N))
                (EQUAL (D-CONE-CONE-D2-D1 (1- N)
                                          (D-CONE-CONE-D2-D1 N A))
                       (ZERO-CONE-CONE-D2-D1 (1- (1- N)))))))
     (AND
      (AND
       (AND
        (AND
         (AND
            (AND (IMPLIES (AND (INV-RING-Z X) (INV-RING-Z Y))
                          (INV-RING-Z (ADDITION-RING-Z X Y)))
                 (IMPLIES (AND (INV-RING-Z X)
                               (INV-RING-Z Y)
                               (INV-RING-Z Z))
                          (EQUAL (ADDITION-RING-Z (ADDITION-RING-Z X Y)
                                                  Z)
                                 (ADDITION-RING-Z X (ADDITION-RING-Z Y Z)))))
            (IMPLIES (INV-RING-Z X)
                     (EQUAL (ADDITION-RING-Z (ZERO-ELEMENT-Z) X)
                            X))
            (IMPLIES (INV-RING-Z X)
                     (EQUAL (ADDITION-RING-Z X (ZERO-ELEMENT-Z))
                            X))
            (INV-RING-Z (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (EQUAL (ADDITION-RING-Z (INVERSE-Z X) X)
                         (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (EQUAL (ADDITION-RING-Z X (INVERSE-Z X))
                         (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (INV-RING-Z (INVERSE-Z X))))
        (AND (AND (IMPLIES (AND (INV-RING-Z X) (INV-RING-Z Y))
                           (INV-RING-Z (PRODUCT-RING-Z X Y)))
                  (IMPLIES (AND (INV-RING-Z X)
                                (INV-RING-Z Y)
                                (INV-RING-Z Z))
                           (EQUAL (PRODUCT-RING-Z (PRODUCT-RING-Z X Y) Z)
                                  (PRODUCT-RING-Z X (PRODUCT-RING-Z Y Z)))))
             (IMPLIES (INV-RING-Z X)
                      (EQUAL (PRODUCT-RING-Z (UNIT-Z) X) X))
             (IMPLIES (INV-RING-Z X)
                      (EQUAL (PRODUCT-RING-Z X (UNIT-Z)) X))
             (INV-RING-Z (UNIT-Z)))
        (IMPLIES (AND (INV-RING-Z X)
                      (INV-RING-Z Y)
                      (INV-RING-Z Z))
                 (EQUAL (PRODUCT-RING-Z X (ADDITION-RING-Z Y Z))
                        (ADDITION-RING-Z (PRODUCT-RING-Z X Y)
                                         (PRODUCT-RING-Z X Z))))
        (IMPLIES (AND (INV-RING-Z X)
                      (INV-RING-Z Y)
                      (INV-RING-Z Z))
                 (EQUAL (PRODUCT-RING-Z (ADDITION-RING-Z X Y) Z)
                        (ADDITION-RING-Z (PRODUCT-RING-Z X Z)
                                         (PRODUCT-RING-Z Y Z)))))
       (IMPLIES
            (AND (INV-CONE-CONE-C2-C1 N A)
                 (INV-CONE-CONE-C2-C1 N B)
                 (INTEGERP N))
            (INV-CONE-CONE-C2-C1 N
                                 (GROUP-OPERATION-CONE-CONE-C2-C1 N A B)))
       (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                     (INV-CONE-CONE-C2-C1 N B)
                     (INV-CONE-CONE-C2-C1 N C)
                     (INTEGERP N))
                (EQUAL (GROUP-OPERATION-CONE-CONE-C2-C1
                            N
                            (GROUP-OPERATION-CONE-CONE-C2-C1 N A B)
                            C)
                       (GROUP-OPERATION-CONE-CONE-C2-C1
                            N A
                            (GROUP-OPERATION-CONE-CONE-C2-C1 N B C))))
       (INV-CONE-CONE-C2-C1 N (ZERO-CONE-CONE-C2-C1 N))
       (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                     (INV-RING-Z R)
                     (INTEGERP N))
                (INV-CONE-CONE-C2-C1 N (EXTERNAL-CONE-CONE-C2-C1 N R A)))
       (IMPLIES
        (AND (INV-CONE-CONE-C2-C1 N A)
             (INTEGERP N))
        (EQUAL (GROUP-OPERATION-CONE-CONE-C2-C1 N A (ZERO-CONE-CONE-C2-C1 N))
               A))
       (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                     (INTEGERP N))
                (INV-CONE-CONE-C2-C1 N (INVERSE-CONE-CONE-C2-C1 N A)))
       (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                     (INV-CONE-CONE-C2-C1 N B)
                     (INTEGERP N)
                     (EQUAL (GROUP-OPERATION-CONE-CONE-C2-C1 N A B)
                            (ZERO-CONE-CONE-C2-C1 N)))
                (EQUAL (INVERSE-CONE-CONE-C2-C1 N A) B))
       (IMPLIES
        (AND (INV-CONE-CONE-C2-C1 N A)
             (INTEGERP N))
        (EQUAL
          (GROUP-OPERATION-CONE-CONE-C2-C1 N A (INVERSE-CONE-CONE-C2-C1 N A))
          (ZERO-CONE-CONE-C2-C1 N)))
       (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                     (INV-CONE-CONE-C2-C1 N B)
                     (INTEGERP N))
                (EQUAL (GROUP-OPERATION-CONE-CONE-C2-C1 N A B)
                       (GROUP-OPERATION-CONE-CONE-C2-C1 N B A)))
       (IMPLIES
        (AND (INV-CONE-CONE-C2-C1 N A)
             (INV-CONE-CONE-C2-C1 N B)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
         (EXTERNAL-CONE-CONE-C2-C1 N R
                                   (GROUP-OPERATION-CONE-CONE-C2-C1 N A B))
         (GROUP-OPERATION-CONE-CONE-C2-C1 N (EXTERNAL-CONE-CONE-C2-C1 N R A)
                                          (EXTERNAL-CONE-CONE-C2-C1 N R B))))
       (IMPLIES
        (AND (INV-CONE-CONE-C2-C1 N A)
             (INV-RING-Z S)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
         (EXTERNAL-CONE-CONE-C2-C1 N (ADDITION-RING-Z S R)
                                   A)
         (GROUP-OPERATION-CONE-CONE-C2-C1 N (EXTERNAL-CONE-CONE-C2-C1 N S A)
                                          (EXTERNAL-CONE-CONE-C2-C1 N R A))))
       (IMPLIES
        (AND (INV-CONE-CONE-C2-C1 N A)
             (INV-RING-Z S)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
            (EXTERNAL-CONE-CONE-C2-C1 N (PRODUCT-RING-Z S R)
                                      A)
            (EXTERNAL-CONE-CONE-C2-C1 N S (EXTERNAL-CONE-CONE-C2-C1 N R A))))
       (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                     (INTEGERP N))
                (EQUAL (EXTERNAL-CONE-CONE-C2-C1 N (UNIT-Z) A)
                       A))
       (IMPLIES
        (AND (INV-CONE-CONE-C2-C1 N A)
             (INV-CONE-CONE-C2-C1 N B)
             (INTEGERP N))
        (EQUAL
            (INVERSE-CONE-CONE-C2-C1 N
                                     (GROUP-OPERATION-CONE-CONE-C2-C1 N A B))
            (GROUP-OPERATION-CONE-CONE-C2-C1 N (INVERSE-CONE-CONE-C2-C1 N A)
                                             (INVERSE-CONE-CONE-C2-C1 N B))))
       (IMPLIES
        (AND (INV-CONE-CONE-C2-C1 N A)
             (INV-RING-Z S)
             (INTEGERP N))
        (EQUAL (INVERSE-CONE-CONE-C2-C1 N (EXTERNAL-CONE-CONE-C2-C1 N S A))
               (EXTERNAL-CONE-CONE-C2-C1 N S (INVERSE-CONE-CONE-C2-C1 N A))))
       (IMPLIES (INTEGERP N)
                (EQUAL (INVERSE-CONE-CONE-C2-C1 N (ZERO-CONE-CONE-C2-C1 N))
                       (ZERO-CONE-CONE-C2-C1 N)))
       (IMPLIES
            (AND (INV-RING-Z S) (INTEGERP N))
            (EQUAL (EXTERNAL-CONE-CONE-C2-C1 N S (ZERO-CONE-CONE-C2-C1 N))
                   (ZERO-CONE-CONE-C2-C1 N))))
      (AND
       (AND
        (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                      (INTEGERP N))
                 (INV-CONE-CONE-C2-C1 (+ N -1)
                                      (D-CONE-CONE-C2-C1 N A)))
        (IMPLIES
           (AND (INV-CONE-CONE-C2-C1 N A)
                (INV-CONE-CONE-C2-C1 N B)
                (INTEGERP N))
           (EQUAL (D-CONE-CONE-C2-C1 N
                                     (GROUP-OPERATION-CONE-CONE-C2-C1 N A B))
                  (GROUP-OPERATION-CONE-CONE-C2-C1 (+ N -1)
                                                   (D-CONE-CONE-C2-C1 N A)
                                                   (D-CONE-CONE-C2-C1 N B))))
        (IMPLIES
             (AND (INV-CONE-CONE-C2-C1 N A)
                  (INV-RING-Z R)
                  (INTEGERP N))
             (EQUAL (D-CONE-CONE-C2-C1 N (EXTERNAL-CONE-CONE-C2-C1 N R A))
                    (EXTERNAL-CONE-CONE-C2-C1 (+ N -1)
                                              R (D-CONE-CONE-C2-C1 N A))))
        (IMPLIES (INTEGERP N)
                 (EQUAL (D-CONE-CONE-C2-C1 N (ZERO-CONE-CONE-C2-C1 N))
                        (ZERO-CONE-CONE-C2-C1 (+ N -1))))
        (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                      (INTEGERP N))
                 (EQUAL (D-CONE-CONE-C2-C1 N (INVERSE-CONE-CONE-C2-C1 N A))
                        (INVERSE-CONE-CONE-C2-C1 (+ N -1)
                                                 (D-CONE-CONE-C2-C1 N A)))))
       (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                     (INTEGERP N))
                (EQUAL (D-CONE-CONE-C2-C1 (1- N)
                                          (D-CONE-CONE-C2-C1 N A))
                       (ZERO-CONE-CONE-C2-C1 (1- (1- N)))))))
     (AND (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                        (INTEGERP N))
                   (INV-CONE-CONE-C2-C1 N (LF-CONES N A)))
          (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                        (INV-CONE-CONE-D2-D1 N B)
                        (INTEGERP N))
                   (EQUAL (LF-CONES N
                                    (GROUP-OPERATION-CONE-CONE-D2-D1 N A B))
                          (GROUP-OPERATION-CONE-CONE-C2-C1 N (LF-CONES N A)
                                                           (LF-CONES N B))))
          (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                        (INV-RING-Z R)
                        (INTEGERP N))
                   (EQUAL (LF-CONES N (EXTERNAL-CONE-CONE-D2-D1 N R A))
                          (EXTERNAL-CONE-CONE-C2-C1 N R (LF-CONES N A))))
          (IMPLIES (INTEGERP N)
                   (EQUAL (LF-CONES N (ZERO-CONE-CONE-D2-D1 N))
                          (ZERO-CONE-CONE-C2-C1 N)))
          (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                        (INTEGERP N))
                   (EQUAL (LF-CONES N (INVERSE-CONE-CONE-D2-D1 N A))
                          (INVERSE-CONE-CONE-C2-C1 N (LF-CONES N A)))))
     (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                   (INTEGERP N))
              (EQUAL (D-CONE-CONE-C2-C1 N (LF-CONES N A))
                     (LF-CONES (1- N)
                               (D-CONE-CONE-D2-D1 N A)))))
    (AND (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                       (INTEGERP N))
                  (INV-CONE-CONE-D2-D1 (+ N 1)
                                       (LH-CONES N A)))
         (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                       (INV-CONE-CONE-D2-D1 N B)
                       (INTEGERP N))
                  (EQUAL (LH-CONES N
                                   (GROUP-OPERATION-CONE-CONE-D2-D1 N A B))
                         (GROUP-OPERATION-CONE-CONE-D2-D1 (+ N 1)
                                                          (LH-CONES N A)
                                                          (LH-CONES N B))))
         (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                       (INV-RING-Z R)
                       (INTEGERP N))
                  (EQUAL (LH-CONES N (EXTERNAL-CONE-CONE-D2-D1 N R A))
                         (EXTERNAL-CONE-CONE-D2-D1 (+ N 1)
                                                   R (LH-CONES N A))))
         (IMPLIES (INTEGERP N)
                  (EQUAL (LH-CONES N (ZERO-CONE-CONE-D2-D1 N))
                         (ZERO-CONE-CONE-D2-D1 (+ N 1))))
         (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                       (INTEGERP N))
                  (EQUAL (LH-CONES N (INVERSE-CONE-CONE-D2-D1 N A))
                         (INVERSE-CONE-CONE-D2-D1 (+ N 1)
                                                  (LH-CONES N A)))))
    (AND
     (AND
      (AND
       (AND
        (AND
         (AND
            (AND (IMPLIES (AND (INV-RING-Z X) (INV-RING-Z Y))
                          (INV-RING-Z (ADDITION-RING-Z X Y)))
                 (IMPLIES (AND (INV-RING-Z X)
                               (INV-RING-Z Y)
                               (INV-RING-Z Z))
                          (EQUAL (ADDITION-RING-Z (ADDITION-RING-Z X Y)
                                                  Z)
                                 (ADDITION-RING-Z X (ADDITION-RING-Z Y Z)))))
            (IMPLIES (INV-RING-Z X)
                     (EQUAL (ADDITION-RING-Z (ZERO-ELEMENT-Z) X)
                            X))
            (IMPLIES (INV-RING-Z X)
                     (EQUAL (ADDITION-RING-Z X (ZERO-ELEMENT-Z))
                            X))
            (INV-RING-Z (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (EQUAL (ADDITION-RING-Z (INVERSE-Z X) X)
                         (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (EQUAL (ADDITION-RING-Z X (INVERSE-Z X))
                         (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (INV-RING-Z (INVERSE-Z X))))
        (AND (AND (IMPLIES (AND (INV-RING-Z X) (INV-RING-Z Y))
                           (INV-RING-Z (PRODUCT-RING-Z X Y)))
                  (IMPLIES (AND (INV-RING-Z X)
                                (INV-RING-Z Y)
                                (INV-RING-Z Z))
                           (EQUAL (PRODUCT-RING-Z (PRODUCT-RING-Z X Y) Z)
                                  (PRODUCT-RING-Z X (PRODUCT-RING-Z Y Z)))))
             (IMPLIES (INV-RING-Z X)
                      (EQUAL (PRODUCT-RING-Z (UNIT-Z) X) X))
             (IMPLIES (INV-RING-Z X)
                      (EQUAL (PRODUCT-RING-Z X (UNIT-Z)) X))
             (INV-RING-Z (UNIT-Z)))
        (IMPLIES (AND (INV-RING-Z X)
                      (INV-RING-Z Y)
                      (INV-RING-Z Z))
                 (EQUAL (PRODUCT-RING-Z X (ADDITION-RING-Z Y Z))
                        (ADDITION-RING-Z (PRODUCT-RING-Z X Y)
                                         (PRODUCT-RING-Z X Z))))
        (IMPLIES (AND (INV-RING-Z X)
                      (INV-RING-Z Y)
                      (INV-RING-Z Z))
                 (EQUAL (PRODUCT-RING-Z (ADDITION-RING-Z X Y) Z)
                        (ADDITION-RING-Z (PRODUCT-RING-Z X Z)
                                         (PRODUCT-RING-Z Y Z)))))
       (IMPLIES
            (AND (INV-CONE-CONE-C2-C1 N A)
                 (INV-CONE-CONE-C2-C1 N B)
                 (INTEGERP N))
            (INV-CONE-CONE-C2-C1 N
                                 (GROUP-OPERATION-CONE-CONE-C2-C1 N A B)))
       (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                     (INV-CONE-CONE-C2-C1 N B)
                     (INV-CONE-CONE-C2-C1 N C)
                     (INTEGERP N))
                (EQUAL (GROUP-OPERATION-CONE-CONE-C2-C1
                            N
                            (GROUP-OPERATION-CONE-CONE-C2-C1 N A B)
                            C)
                       (GROUP-OPERATION-CONE-CONE-C2-C1
                            N A
                            (GROUP-OPERATION-CONE-CONE-C2-C1 N B C))))
       (INV-CONE-CONE-C2-C1 N (ZERO-CONE-CONE-C2-C1 N))
       (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                     (INV-RING-Z R)
                     (INTEGERP N))
                (INV-CONE-CONE-C2-C1 N (EXTERNAL-CONE-CONE-C2-C1 N R A)))
       (IMPLIES
        (AND (INV-CONE-CONE-C2-C1 N A)
             (INTEGERP N))
        (EQUAL (GROUP-OPERATION-CONE-CONE-C2-C1 N A (ZERO-CONE-CONE-C2-C1 N))
               A))
       (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                     (INTEGERP N))
                (INV-CONE-CONE-C2-C1 N (INVERSE-CONE-CONE-C2-C1 N A)))
       (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                     (INV-CONE-CONE-C2-C1 N B)
                     (INTEGERP N)
                     (EQUAL (GROUP-OPERATION-CONE-CONE-C2-C1 N A B)
                            (ZERO-CONE-CONE-C2-C1 N)))
                (EQUAL (INVERSE-CONE-CONE-C2-C1 N A) B))
       (IMPLIES
        (AND (INV-CONE-CONE-C2-C1 N A)
             (INTEGERP N))
        (EQUAL
          (GROUP-OPERATION-CONE-CONE-C2-C1 N A (INVERSE-CONE-CONE-C2-C1 N A))
          (ZERO-CONE-CONE-C2-C1 N)))
       (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                     (INV-CONE-CONE-C2-C1 N B)
                     (INTEGERP N))
                (EQUAL (GROUP-OPERATION-CONE-CONE-C2-C1 N A B)
                       (GROUP-OPERATION-CONE-CONE-C2-C1 N B A)))
       (IMPLIES
        (AND (INV-CONE-CONE-C2-C1 N A)
             (INV-CONE-CONE-C2-C1 N B)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
         (EXTERNAL-CONE-CONE-C2-C1 N R
                                   (GROUP-OPERATION-CONE-CONE-C2-C1 N A B))
         (GROUP-OPERATION-CONE-CONE-C2-C1 N (EXTERNAL-CONE-CONE-C2-C1 N R A)
                                          (EXTERNAL-CONE-CONE-C2-C1 N R B))))
       (IMPLIES
        (AND (INV-CONE-CONE-C2-C1 N A)
             (INV-RING-Z S)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
         (EXTERNAL-CONE-CONE-C2-C1 N (ADDITION-RING-Z S R)
                                   A)
         (GROUP-OPERATION-CONE-CONE-C2-C1 N (EXTERNAL-CONE-CONE-C2-C1 N S A)
                                          (EXTERNAL-CONE-CONE-C2-C1 N R A))))
       (IMPLIES
        (AND (INV-CONE-CONE-C2-C1 N A)
             (INV-RING-Z S)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
            (EXTERNAL-CONE-CONE-C2-C1 N (PRODUCT-RING-Z S R)
                                      A)
            (EXTERNAL-CONE-CONE-C2-C1 N S (EXTERNAL-CONE-CONE-C2-C1 N R A))))
       (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                     (INTEGERP N))
                (EQUAL (EXTERNAL-CONE-CONE-C2-C1 N (UNIT-Z) A)
                       A))
       (IMPLIES
        (AND (INV-CONE-CONE-C2-C1 N A)
             (INV-CONE-CONE-C2-C1 N B)
             (INTEGERP N))
        (EQUAL
            (INVERSE-CONE-CONE-C2-C1 N
                                     (GROUP-OPERATION-CONE-CONE-C2-C1 N A B))
            (GROUP-OPERATION-CONE-CONE-C2-C1 N (INVERSE-CONE-CONE-C2-C1 N A)
                                             (INVERSE-CONE-CONE-C2-C1 N B))))
       (IMPLIES
        (AND (INV-CONE-CONE-C2-C1 N A)
             (INV-RING-Z S)
             (INTEGERP N))
        (EQUAL (INVERSE-CONE-CONE-C2-C1 N (EXTERNAL-CONE-CONE-C2-C1 N S A))
               (EXTERNAL-CONE-CONE-C2-C1 N S (INVERSE-CONE-CONE-C2-C1 N A))))
       (IMPLIES (INTEGERP N)
                (EQUAL (INVERSE-CONE-CONE-C2-C1 N (ZERO-CONE-CONE-C2-C1 N))
                       (ZERO-CONE-CONE-C2-C1 N)))
       (IMPLIES
            (AND (INV-RING-Z S) (INTEGERP N))
            (EQUAL (EXTERNAL-CONE-CONE-C2-C1 N S (ZERO-CONE-CONE-C2-C1 N))
                   (ZERO-CONE-CONE-C2-C1 N))))
      (AND
       (AND
        (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                      (INTEGERP N))
                 (INV-CONE-CONE-C2-C1 (+ N -1)
                                      (D-CONE-CONE-C2-C1 N A)))
        (IMPLIES
           (AND (INV-CONE-CONE-C2-C1 N A)
                (INV-CONE-CONE-C2-C1 N B)
                (INTEGERP N))
           (EQUAL (D-CONE-CONE-C2-C1 N
                                     (GROUP-OPERATION-CONE-CONE-C2-C1 N A B))
                  (GROUP-OPERATION-CONE-CONE-C2-C1 (+ N -1)
                                                   (D-CONE-CONE-C2-C1 N A)
                                                   (D-CONE-CONE-C2-C1 N B))))
        (IMPLIES
             (AND (INV-CONE-CONE-C2-C1 N A)
                  (INV-RING-Z R)
                  (INTEGERP N))
             (EQUAL (D-CONE-CONE-C2-C1 N (EXTERNAL-CONE-CONE-C2-C1 N R A))
                    (EXTERNAL-CONE-CONE-C2-C1 (+ N -1)
                                              R (D-CONE-CONE-C2-C1 N A))))
        (IMPLIES (INTEGERP N)
                 (EQUAL (D-CONE-CONE-C2-C1 N (ZERO-CONE-CONE-C2-C1 N))
                        (ZERO-CONE-CONE-C2-C1 (+ N -1))))
        (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                      (INTEGERP N))
                 (EQUAL (D-CONE-CONE-C2-C1 N (INVERSE-CONE-CONE-C2-C1 N A))
                        (INVERSE-CONE-CONE-C2-C1 (+ N -1)
                                                 (D-CONE-CONE-C2-C1 N A)))))
       (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                     (INTEGERP N))
                (EQUAL (D-CONE-CONE-C2-C1 (1- N)
                                          (D-CONE-CONE-C2-C1 N A))
                       (ZERO-CONE-CONE-C2-C1 (1- (1- N)))))))
     (AND
      (AND
       (AND
        (AND
         (AND
            (AND (IMPLIES (AND (INV-RING-Z X) (INV-RING-Z Y))
                          (INV-RING-Z (ADDITION-RING-Z X Y)))
                 (IMPLIES (AND (INV-RING-Z X)
                               (INV-RING-Z Y)
                               (INV-RING-Z Z))
                          (EQUAL (ADDITION-RING-Z (ADDITION-RING-Z X Y)
                                                  Z)
                                 (ADDITION-RING-Z X (ADDITION-RING-Z Y Z)))))
            (IMPLIES (INV-RING-Z X)
                     (EQUAL (ADDITION-RING-Z (ZERO-ELEMENT-Z) X)
                            X))
            (IMPLIES (INV-RING-Z X)
                     (EQUAL (ADDITION-RING-Z X (ZERO-ELEMENT-Z))
                            X))
            (INV-RING-Z (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (EQUAL (ADDITION-RING-Z (INVERSE-Z X) X)
                         (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (EQUAL (ADDITION-RING-Z X (INVERSE-Z X))
                         (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (INV-RING-Z (INVERSE-Z X))))
        (AND (AND (IMPLIES (AND (INV-RING-Z X) (INV-RING-Z Y))
                           (INV-RING-Z (PRODUCT-RING-Z X Y)))
                  (IMPLIES (AND (INV-RING-Z X)
                                (INV-RING-Z Y)
                                (INV-RING-Z Z))
                           (EQUAL (PRODUCT-RING-Z (PRODUCT-RING-Z X Y) Z)
                                  (PRODUCT-RING-Z X (PRODUCT-RING-Z Y Z)))))
             (IMPLIES (INV-RING-Z X)
                      (EQUAL (PRODUCT-RING-Z (UNIT-Z) X) X))
             (IMPLIES (INV-RING-Z X)
                      (EQUAL (PRODUCT-RING-Z X (UNIT-Z)) X))
             (INV-RING-Z (UNIT-Z)))
        (IMPLIES (AND (INV-RING-Z X)
                      (INV-RING-Z Y)
                      (INV-RING-Z Z))
                 (EQUAL (PRODUCT-RING-Z X (ADDITION-RING-Z Y Z))
                        (ADDITION-RING-Z (PRODUCT-RING-Z X Y)
                                         (PRODUCT-RING-Z X Z))))
        (IMPLIES (AND (INV-RING-Z X)
                      (INV-RING-Z Y)
                      (INV-RING-Z Z))
                 (EQUAL (PRODUCT-RING-Z (ADDITION-RING-Z X Y) Z)
                        (ADDITION-RING-Z (PRODUCT-RING-Z X Z)
                                         (PRODUCT-RING-Z Y Z)))))
       (IMPLIES
            (AND (INV-CONE-CONE-D2-D1 N A)
                 (INV-CONE-CONE-D2-D1 N B)
                 (INTEGERP N))
            (INV-CONE-CONE-D2-D1 N
                                 (GROUP-OPERATION-CONE-CONE-D2-D1 N A B)))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INV-CONE-CONE-D2-D1 N B)
                     (INV-CONE-CONE-D2-D1 N C)
                     (INTEGERP N))
                (EQUAL (GROUP-OPERATION-CONE-CONE-D2-D1
                            N
                            (GROUP-OPERATION-CONE-CONE-D2-D1 N A B)
                            C)
                       (GROUP-OPERATION-CONE-CONE-D2-D1
                            N A
                            (GROUP-OPERATION-CONE-CONE-D2-D1 N B C))))
       (INV-CONE-CONE-D2-D1 N (ZERO-CONE-CONE-D2-D1 N))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INV-RING-Z R)
                     (INTEGERP N))
                (INV-CONE-CONE-D2-D1 N (EXTERNAL-CONE-CONE-D2-D1 N R A)))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INTEGERP N))
        (EQUAL (GROUP-OPERATION-CONE-CONE-D2-D1 N A (ZERO-CONE-CONE-D2-D1 N))
               A))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INTEGERP N))
                (INV-CONE-CONE-D2-D1 N (INVERSE-CONE-CONE-D2-D1 N A)))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INV-CONE-CONE-D2-D1 N B)
                     (INTEGERP N)
                     (EQUAL (GROUP-OPERATION-CONE-CONE-D2-D1 N A B)
                            (ZERO-CONE-CONE-D2-D1 N)))
                (EQUAL (INVERSE-CONE-CONE-D2-D1 N A) B))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INTEGERP N))
        (EQUAL
          (GROUP-OPERATION-CONE-CONE-D2-D1 N A (INVERSE-CONE-CONE-D2-D1 N A))
          (ZERO-CONE-CONE-D2-D1 N)))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INV-CONE-CONE-D2-D1 N B)
                     (INTEGERP N))
                (EQUAL (GROUP-OPERATION-CONE-CONE-D2-D1 N A B)
                       (GROUP-OPERATION-CONE-CONE-D2-D1 N B A)))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INV-CONE-CONE-D2-D1 N B)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
         (EXTERNAL-CONE-CONE-D2-D1 N R
                                   (GROUP-OPERATION-CONE-CONE-D2-D1 N A B))
         (GROUP-OPERATION-CONE-CONE-D2-D1 N (EXTERNAL-CONE-CONE-D2-D1 N R A)
                                          (EXTERNAL-CONE-CONE-D2-D1 N R B))))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INV-RING-Z S)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
         (EXTERNAL-CONE-CONE-D2-D1 N (ADDITION-RING-Z S R)
                                   A)
         (GROUP-OPERATION-CONE-CONE-D2-D1 N (EXTERNAL-CONE-CONE-D2-D1 N S A)
                                          (EXTERNAL-CONE-CONE-D2-D1 N R A))))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INV-RING-Z S)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
            (EXTERNAL-CONE-CONE-D2-D1 N (PRODUCT-RING-Z S R)
                                      A)
            (EXTERNAL-CONE-CONE-D2-D1 N S (EXTERNAL-CONE-CONE-D2-D1 N R A))))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INTEGERP N))
                (EQUAL (EXTERNAL-CONE-CONE-D2-D1 N (UNIT-Z) A)
                       A))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INV-CONE-CONE-D2-D1 N B)
             (INTEGERP N))
        (EQUAL
            (INVERSE-CONE-CONE-D2-D1 N
                                     (GROUP-OPERATION-CONE-CONE-D2-D1 N A B))
            (GROUP-OPERATION-CONE-CONE-D2-D1 N (INVERSE-CONE-CONE-D2-D1 N A)
                                             (INVERSE-CONE-CONE-D2-D1 N B))))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INV-RING-Z S)
             (INTEGERP N))
        (EQUAL (INVERSE-CONE-CONE-D2-D1 N (EXTERNAL-CONE-CONE-D2-D1 N S A))
               (EXTERNAL-CONE-CONE-D2-D1 N S (INVERSE-CONE-CONE-D2-D1 N A))))
       (IMPLIES (INTEGERP N)
                (EQUAL (INVERSE-CONE-CONE-D2-D1 N (ZERO-CONE-CONE-D2-D1 N))
                       (ZERO-CONE-CONE-D2-D1 N)))
       (IMPLIES
            (AND (INV-RING-Z S) (INTEGERP N))
            (EQUAL (EXTERNAL-CONE-CONE-D2-D1 N S (ZERO-CONE-CONE-D2-D1 N))
                   (ZERO-CONE-CONE-D2-D1 N))))
      (AND
       (AND
        (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                      (INTEGERP N))
                 (INV-CONE-CONE-D2-D1 (+ N -1)
                                      (D-CONE-CONE-D2-D1 N A)))
        (IMPLIES
           (AND (INV-CONE-CONE-D2-D1 N A)
                (INV-CONE-CONE-D2-D1 N B)
                (INTEGERP N))
           (EQUAL (D-CONE-CONE-D2-D1 N
                                     (GROUP-OPERATION-CONE-CONE-D2-D1 N A B))
                  (GROUP-OPERATION-CONE-CONE-D2-D1 (+ N -1)
                                                   (D-CONE-CONE-D2-D1 N A)
                                                   (D-CONE-CONE-D2-D1 N B))))
        (IMPLIES
             (AND (INV-CONE-CONE-D2-D1 N A)
                  (INV-RING-Z R)
                  (INTEGERP N))
             (EQUAL (D-CONE-CONE-D2-D1 N (EXTERNAL-CONE-CONE-D2-D1 N R A))
                    (EXTERNAL-CONE-CONE-D2-D1 (+ N -1)
                                              R (D-CONE-CONE-D2-D1 N A))))
        (IMPLIES (INTEGERP N)
                 (EQUAL (D-CONE-CONE-D2-D1 N (ZERO-CONE-CONE-D2-D1 N))
                        (ZERO-CONE-CONE-D2-D1 (+ N -1))))
        (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                      (INTEGERP N))
                 (EQUAL (D-CONE-CONE-D2-D1 N (INVERSE-CONE-CONE-D2-D1 N A))
                        (INVERSE-CONE-CONE-D2-D1 (+ N -1)
                                                 (D-CONE-CONE-D2-D1 N A)))))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INTEGERP N))
                (EQUAL (D-CONE-CONE-D2-D1 (1- N)
                                          (D-CONE-CONE-D2-D1 N A))
                       (ZERO-CONE-CONE-D2-D1 (1- (1- N)))))))
     (AND (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                        (INTEGERP N))
                   (INV-CONE-CONE-D2-D1 N (LG-CONES N A)))
          (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                        (INV-CONE-CONE-C2-C1 N B)
                        (INTEGERP N))
                   (EQUAL (LG-CONES N
                                    (GROUP-OPERATION-CONE-CONE-C2-C1 N A B))
                          (GROUP-OPERATION-CONE-CONE-D2-D1 N (LG-CONES N A)
                                                           (LG-CONES N B))))
          (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                        (INV-RING-Z R)
                        (INTEGERP N))
                   (EQUAL (LG-CONES N (EXTERNAL-CONE-CONE-C2-C1 N R A))
                          (EXTERNAL-CONE-CONE-D2-D1 N R (LG-CONES N A))))
          (IMPLIES (INTEGERP N)
                   (EQUAL (LG-CONES N (ZERO-CONE-CONE-C2-C1 N))
                          (ZERO-CONE-CONE-D2-D1 N)))
          (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                        (INTEGERP N))
                   (EQUAL (LG-CONES N (INVERSE-CONE-CONE-C2-C1 N A))
                          (INVERSE-CONE-CONE-D2-D1 N (LG-CONES N A)))))
     (IMPLIES (AND (INV-CONE-CONE-C2-C1 N A)
                   (INTEGERP N))
              (EQUAL (D-CONE-CONE-D2-D1 N (LG-CONES N A))
                     (LG-CONES (1- N)
                               (D-CONE-CONE-C2-C1 N A)))))
    (IMPLIES (AND (INV-CONE-CONE-C2-C1 N GNRT)
                  (INTEGERP N))
             (EQUAL (LF-CONES N (LG-CONES N GNRT))
                    GNRT))
    (IMPLIES
     (AND (INV-CONE-CONE-D2-D1 N GNRT)
          (INTEGERP N))
     (EQUAL
      (GROUP-OPERATION-CONE-CONE-D2-D1 N
                                       (LH-CONES (1- N)
                                                 (D-CONE-CONE-D2-D1 N GNRT))
                                       (D-CONE-CONE-D2-D1 (1+ N)
                                                          (LH-CONES N GNRT)))
      (GROUP-OPERATION-CONE-CONE-D2-D1
           N GNRT
           (INVERSE-CONE-CONE-D2-D1 N (LG-CONES N (LF-CONES N GNRT))))))
    (IMPLIES (AND (INV-CONE-CONE-D2-D1 N GNRT)
                  (INTEGERP N))
             (EQUAL (LF-CONES (1+ N) (LH-CONES N GNRT))
                    (ZERO-CONE-CONE-C2-C1 (1+ N))))
    (IMPLIES (AND (INV-CONE-CONE-C2-C1 N GNRT)
                  (INTEGERP N))
             (EQUAL (LH-CONES N (LG-CONES N GNRT))
                    (ZERO-CONE-CONE-D2-D1 (1+ N))))
    (IMPLIES (AND (INV-CONE-CONE-D2-D1 N GNRT)
                  (INTEGERP N))
             (EQUAL (LH-CONES (1+ N) (LH-CONES N GNRT))
                    (ZERO-CONE-CONE-D2-D1 (1+ (1+ N))))))
   (AND
    (AND
     (AND
      (AND
       (AND
        (AND
         (AND
            (AND (IMPLIES (AND (INV-RING-Z X) (INV-RING-Z Y))
                          (INV-RING-Z (ADDITION-RING-Z X Y)))
                 (IMPLIES (AND (INV-RING-Z X)
                               (INV-RING-Z Y)
                               (INV-RING-Z Z))
                          (EQUAL (ADDITION-RING-Z (ADDITION-RING-Z X Y)
                                                  Z)
                                 (ADDITION-RING-Z X (ADDITION-RING-Z Y Z)))))
            (IMPLIES (INV-RING-Z X)
                     (EQUAL (ADDITION-RING-Z (ZERO-ELEMENT-Z) X)
                            X))
            (IMPLIES (INV-RING-Z X)
                     (EQUAL (ADDITION-RING-Z X (ZERO-ELEMENT-Z))
                            X))
            (INV-RING-Z (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (EQUAL (ADDITION-RING-Z (INVERSE-Z X) X)
                         (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (EQUAL (ADDITION-RING-Z X (INVERSE-Z X))
                         (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (INV-RING-Z (INVERSE-Z X))))
        (AND (AND (IMPLIES (AND (INV-RING-Z X) (INV-RING-Z Y))
                           (INV-RING-Z (PRODUCT-RING-Z X Y)))
                  (IMPLIES (AND (INV-RING-Z X)
                                (INV-RING-Z Y)
                                (INV-RING-Z Z))
                           (EQUAL (PRODUCT-RING-Z (PRODUCT-RING-Z X Y) Z)
                                  (PRODUCT-RING-Z X (PRODUCT-RING-Z Y Z)))))
             (IMPLIES (INV-RING-Z X)
                      (EQUAL (PRODUCT-RING-Z (UNIT-Z) X) X))
             (IMPLIES (INV-RING-Z X)
                      (EQUAL (PRODUCT-RING-Z X (UNIT-Z)) X))
             (INV-RING-Z (UNIT-Z)))
        (IMPLIES (AND (INV-RING-Z X)
                      (INV-RING-Z Y)
                      (INV-RING-Z Z))
                 (EQUAL (PRODUCT-RING-Z X (ADDITION-RING-Z Y Z))
                        (ADDITION-RING-Z (PRODUCT-RING-Z X Y)
                                         (PRODUCT-RING-Z X Z))))
        (IMPLIES (AND (INV-RING-Z X)
                      (INV-RING-Z Y)
                      (INV-RING-Z Z))
                 (EQUAL (PRODUCT-RING-Z (ADDITION-RING-Z X Y) Z)
                        (ADDITION-RING-Z (PRODUCT-RING-Z X Z)
                                         (PRODUCT-RING-Z Y Z)))))
       (IMPLIES
            (AND (INV-CONE-CONE-D2-D1 N A)
                 (INV-CONE-CONE-D2-D1 N B)
                 (INTEGERP N))
            (INV-CONE-CONE-D2-D1 N
                                 (GROUP-OPERATION-CONE-CONE-D2-D1 N A B)))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INV-CONE-CONE-D2-D1 N B)
                     (INV-CONE-CONE-D2-D1 N C)
                     (INTEGERP N))
                (EQUAL (GROUP-OPERATION-CONE-CONE-D2-D1
                            N
                            (GROUP-OPERATION-CONE-CONE-D2-D1 N A B)
                            C)
                       (GROUP-OPERATION-CONE-CONE-D2-D1
                            N A
                            (GROUP-OPERATION-CONE-CONE-D2-D1 N B C))))
       (INV-CONE-CONE-D2-D1 N (ZERO-CONE-CONE-D2-D1 N))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INV-RING-Z R)
                     (INTEGERP N))
                (INV-CONE-CONE-D2-D1 N (EXTERNAL-CONE-CONE-D2-D1 N R A)))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INTEGERP N))
        (EQUAL (GROUP-OPERATION-CONE-CONE-D2-D1 N A (ZERO-CONE-CONE-D2-D1 N))
               A))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INTEGERP N))
                (INV-CONE-CONE-D2-D1 N (INVERSE-CONE-CONE-D2-D1 N A)))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INV-CONE-CONE-D2-D1 N B)
                     (INTEGERP N)
                     (EQUAL (GROUP-OPERATION-CONE-CONE-D2-D1 N A B)
                            (ZERO-CONE-CONE-D2-D1 N)))
                (EQUAL (INVERSE-CONE-CONE-D2-D1 N A) B))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INTEGERP N))
        (EQUAL
          (GROUP-OPERATION-CONE-CONE-D2-D1 N A (INVERSE-CONE-CONE-D2-D1 N A))
          (ZERO-CONE-CONE-D2-D1 N)))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INV-CONE-CONE-D2-D1 N B)
                     (INTEGERP N))
                (EQUAL (GROUP-OPERATION-CONE-CONE-D2-D1 N A B)
                       (GROUP-OPERATION-CONE-CONE-D2-D1 N B A)))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INV-CONE-CONE-D2-D1 N B)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
         (EXTERNAL-CONE-CONE-D2-D1 N R
                                   (GROUP-OPERATION-CONE-CONE-D2-D1 N A B))
         (GROUP-OPERATION-CONE-CONE-D2-D1 N (EXTERNAL-CONE-CONE-D2-D1 N R A)
                                          (EXTERNAL-CONE-CONE-D2-D1 N R B))))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INV-RING-Z S)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
         (EXTERNAL-CONE-CONE-D2-D1 N (ADDITION-RING-Z S R)
                                   A)
         (GROUP-OPERATION-CONE-CONE-D2-D1 N (EXTERNAL-CONE-CONE-D2-D1 N S A)
                                          (EXTERNAL-CONE-CONE-D2-D1 N R A))))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INV-RING-Z S)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
            (EXTERNAL-CONE-CONE-D2-D1 N (PRODUCT-RING-Z S R)
                                      A)
            (EXTERNAL-CONE-CONE-D2-D1 N S (EXTERNAL-CONE-CONE-D2-D1 N R A))))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INTEGERP N))
                (EQUAL (EXTERNAL-CONE-CONE-D2-D1 N (UNIT-Z) A)
                       A))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INV-CONE-CONE-D2-D1 N B)
             (INTEGERP N))
        (EQUAL
            (INVERSE-CONE-CONE-D2-D1 N
                                     (GROUP-OPERATION-CONE-CONE-D2-D1 N A B))
            (GROUP-OPERATION-CONE-CONE-D2-D1 N (INVERSE-CONE-CONE-D2-D1 N A)
                                             (INVERSE-CONE-CONE-D2-D1 N B))))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INV-RING-Z S)
             (INTEGERP N))
        (EQUAL (INVERSE-CONE-CONE-D2-D1 N (EXTERNAL-CONE-CONE-D2-D1 N S A))
               (EXTERNAL-CONE-CONE-D2-D1 N S (INVERSE-CONE-CONE-D2-D1 N A))))
       (IMPLIES (INTEGERP N)
                (EQUAL (INVERSE-CONE-CONE-D2-D1 N (ZERO-CONE-CONE-D2-D1 N))
                       (ZERO-CONE-CONE-D2-D1 N)))
       (IMPLIES
            (AND (INV-RING-Z S) (INTEGERP N))
            (EQUAL (EXTERNAL-CONE-CONE-D2-D1 N S (ZERO-CONE-CONE-D2-D1 N))
                   (ZERO-CONE-CONE-D2-D1 N))))
      (AND
       (AND
        (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                      (INTEGERP N))
                 (INV-CONE-CONE-D2-D1 (+ N -1)
                                      (D-CONE-CONE-D2-D1 N A)))
        (IMPLIES
           (AND (INV-CONE-CONE-D2-D1 N A)
                (INV-CONE-CONE-D2-D1 N B)
                (INTEGERP N))
           (EQUAL (D-CONE-CONE-D2-D1 N
                                     (GROUP-OPERATION-CONE-CONE-D2-D1 N A B))
                  (GROUP-OPERATION-CONE-CONE-D2-D1 (+ N -1)
                                                   (D-CONE-CONE-D2-D1 N A)
                                                   (D-CONE-CONE-D2-D1 N B))))
        (IMPLIES
             (AND (INV-CONE-CONE-D2-D1 N A)
                  (INV-RING-Z R)
                  (INTEGERP N))
             (EQUAL (D-CONE-CONE-D2-D1 N (EXTERNAL-CONE-CONE-D2-D1 N R A))
                    (EXTERNAL-CONE-CONE-D2-D1 (+ N -1)
                                              R (D-CONE-CONE-D2-D1 N A))))
        (IMPLIES (INTEGERP N)
                 (EQUAL (D-CONE-CONE-D2-D1 N (ZERO-CONE-CONE-D2-D1 N))
                        (ZERO-CONE-CONE-D2-D1 (+ N -1))))
        (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                      (INTEGERP N))
                 (EQUAL (D-CONE-CONE-D2-D1 N (INVERSE-CONE-CONE-D2-D1 N A))
                        (INVERSE-CONE-CONE-D2-D1 (+ N -1)
                                                 (D-CONE-CONE-D2-D1 N A)))))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INTEGERP N))
                (EQUAL (D-CONE-CONE-D2-D1 (1- N)
                                          (D-CONE-CONE-D2-D1 N A))
                       (ZERO-CONE-CONE-D2-D1 (1- (1- N)))))))
     (AND
      (AND
       (AND
        (AND
         (AND
            (AND (IMPLIES (AND (INV-RING-Z X) (INV-RING-Z Y))
                          (INV-RING-Z (ADDITION-RING-Z X Y)))
                 (IMPLIES (AND (INV-RING-Z X)
                               (INV-RING-Z Y)
                               (INV-RING-Z Z))
                          (EQUAL (ADDITION-RING-Z (ADDITION-RING-Z X Y)
                                                  Z)
                                 (ADDITION-RING-Z X (ADDITION-RING-Z Y Z)))))
            (IMPLIES (INV-RING-Z X)
                     (EQUAL (ADDITION-RING-Z (ZERO-ELEMENT-Z) X)
                            X))
            (IMPLIES (INV-RING-Z X)
                     (EQUAL (ADDITION-RING-Z X (ZERO-ELEMENT-Z))
                            X))
            (INV-RING-Z (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (EQUAL (ADDITION-RING-Z (INVERSE-Z X) X)
                         (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (EQUAL (ADDITION-RING-Z X (INVERSE-Z X))
                         (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (INV-RING-Z (INVERSE-Z X))))
        (AND (AND (IMPLIES (AND (INV-RING-Z X) (INV-RING-Z Y))
                           (INV-RING-Z (PRODUCT-RING-Z X Y)))
                  (IMPLIES (AND (INV-RING-Z X)
                                (INV-RING-Z Y)
                                (INV-RING-Z Z))
                           (EQUAL (PRODUCT-RING-Z (PRODUCT-RING-Z X Y) Z)
                                  (PRODUCT-RING-Z X (PRODUCT-RING-Z Y Z)))))
             (IMPLIES (INV-RING-Z X)
                      (EQUAL (PRODUCT-RING-Z (UNIT-Z) X) X))
             (IMPLIES (INV-RING-Z X)
                      (EQUAL (PRODUCT-RING-Z X (UNIT-Z)) X))
             (INV-RING-Z (UNIT-Z)))
        (IMPLIES (AND (INV-RING-Z X)
                      (INV-RING-Z Y)
                      (INV-RING-Z Z))
                 (EQUAL (PRODUCT-RING-Z X (ADDITION-RING-Z Y Z))
                        (ADDITION-RING-Z (PRODUCT-RING-Z X Y)
                                         (PRODUCT-RING-Z X Z))))
        (IMPLIES (AND (INV-RING-Z X)
                      (INV-RING-Z Y)
                      (INV-RING-Z Z))
                 (EQUAL (PRODUCT-RING-Z (ADDITION-RING-Z X Y) Z)
                        (ADDITION-RING-Z (PRODUCT-RING-Z X Z)
                                         (PRODUCT-RING-Z Y Z)))))
       (IMPLIES
            (AND (INV-CONE-CONE-H2-H1 N A)
                 (INV-CONE-CONE-H2-H1 N B)
                 (INTEGERP N))
            (INV-CONE-CONE-H2-H1 N
                                 (GROUP-OPERATION-CONE-CONE-H2-H1 N A B)))
       (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                     (INV-CONE-CONE-H2-H1 N B)
                     (INV-CONE-CONE-H2-H1 N C)
                     (INTEGERP N))
                (EQUAL (GROUP-OPERATION-CONE-CONE-H2-H1
                            N
                            (GROUP-OPERATION-CONE-CONE-H2-H1 N A B)
                            C)
                       (GROUP-OPERATION-CONE-CONE-H2-H1
                            N A
                            (GROUP-OPERATION-CONE-CONE-H2-H1 N B C))))
       (INV-CONE-CONE-H2-H1 N (ZERO-CONE-CONE-H2-H1 N))
       (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                     (INV-RING-Z R)
                     (INTEGERP N))
                (INV-CONE-CONE-H2-H1 N (EXTERNAL-CONE-CONE-H2-H1 N R A)))
       (IMPLIES
        (AND (INV-CONE-CONE-H2-H1 N A)
             (INTEGERP N))
        (EQUAL (GROUP-OPERATION-CONE-CONE-H2-H1 N A (ZERO-CONE-CONE-H2-H1 N))
               A))
       (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                     (INTEGERP N))
                (INV-CONE-CONE-H2-H1 N (INVERSE-CONE-CONE-H2-H1 N A)))
       (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                     (INV-CONE-CONE-H2-H1 N B)
                     (INTEGERP N)
                     (EQUAL (GROUP-OPERATION-CONE-CONE-H2-H1 N A B)
                            (ZERO-CONE-CONE-H2-H1 N)))
                (EQUAL (INVERSE-CONE-CONE-H2-H1 N A) B))
       (IMPLIES
        (AND (INV-CONE-CONE-H2-H1 N A)
             (INTEGERP N))
        (EQUAL
          (GROUP-OPERATION-CONE-CONE-H2-H1 N A (INVERSE-CONE-CONE-H2-H1 N A))
          (ZERO-CONE-CONE-H2-H1 N)))
       (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                     (INV-CONE-CONE-H2-H1 N B)
                     (INTEGERP N))
                (EQUAL (GROUP-OPERATION-CONE-CONE-H2-H1 N A B)
                       (GROUP-OPERATION-CONE-CONE-H2-H1 N B A)))
       (IMPLIES
        (AND (INV-CONE-CONE-H2-H1 N A)
             (INV-CONE-CONE-H2-H1 N B)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
         (EXTERNAL-CONE-CONE-H2-H1 N R
                                   (GROUP-OPERATION-CONE-CONE-H2-H1 N A B))
         (GROUP-OPERATION-CONE-CONE-H2-H1 N (EXTERNAL-CONE-CONE-H2-H1 N R A)
                                          (EXTERNAL-CONE-CONE-H2-H1 N R B))))
       (IMPLIES
        (AND (INV-CONE-CONE-H2-H1 N A)
             (INV-RING-Z S)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
         (EXTERNAL-CONE-CONE-H2-H1 N (ADDITION-RING-Z S R)
                                   A)
         (GROUP-OPERATION-CONE-CONE-H2-H1 N (EXTERNAL-CONE-CONE-H2-H1 N S A)
                                          (EXTERNAL-CONE-CONE-H2-H1 N R A))))
       (IMPLIES
        (AND (INV-CONE-CONE-H2-H1 N A)
             (INV-RING-Z S)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
            (EXTERNAL-CONE-CONE-H2-H1 N (PRODUCT-RING-Z S R)
                                      A)
            (EXTERNAL-CONE-CONE-H2-H1 N S (EXTERNAL-CONE-CONE-H2-H1 N R A))))
       (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                     (INTEGERP N))
                (EQUAL (EXTERNAL-CONE-CONE-H2-H1 N (UNIT-Z) A)
                       A))
       (IMPLIES
        (AND (INV-CONE-CONE-H2-H1 N A)
             (INV-CONE-CONE-H2-H1 N B)
             (INTEGERP N))
        (EQUAL
            (INVERSE-CONE-CONE-H2-H1 N
                                     (GROUP-OPERATION-CONE-CONE-H2-H1 N A B))
            (GROUP-OPERATION-CONE-CONE-H2-H1 N (INVERSE-CONE-CONE-H2-H1 N A)
                                             (INVERSE-CONE-CONE-H2-H1 N B))))
       (IMPLIES
        (AND (INV-CONE-CONE-H2-H1 N A)
             (INV-RING-Z S)
             (INTEGERP N))
        (EQUAL (INVERSE-CONE-CONE-H2-H1 N (EXTERNAL-CONE-CONE-H2-H1 N S A))
               (EXTERNAL-CONE-CONE-H2-H1 N S (INVERSE-CONE-CONE-H2-H1 N A))))
       (IMPLIES (INTEGERP N)
                (EQUAL (INVERSE-CONE-CONE-H2-H1 N (ZERO-CONE-CONE-H2-H1 N))
                       (ZERO-CONE-CONE-H2-H1 N)))
       (IMPLIES
            (AND (INV-RING-Z S) (INTEGERP N))
            (EQUAL (EXTERNAL-CONE-CONE-H2-H1 N S (ZERO-CONE-CONE-H2-H1 N))
                   (ZERO-CONE-CONE-H2-H1 N))))
      (AND
       (AND
        (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                      (INTEGERP N))
                 (INV-CONE-CONE-H2-H1 (+ N -1)
                                      (D-CONE-CONE-H2-H1 N A)))
        (IMPLIES
           (AND (INV-CONE-CONE-H2-H1 N A)
                (INV-CONE-CONE-H2-H1 N B)
                (INTEGERP N))
           (EQUAL (D-CONE-CONE-H2-H1 N
                                     (GROUP-OPERATION-CONE-CONE-H2-H1 N A B))
                  (GROUP-OPERATION-CONE-CONE-H2-H1 (+ N -1)
                                                   (D-CONE-CONE-H2-H1 N A)
                                                   (D-CONE-CONE-H2-H1 N B))))
        (IMPLIES
             (AND (INV-CONE-CONE-H2-H1 N A)
                  (INV-RING-Z R)
                  (INTEGERP N))
             (EQUAL (D-CONE-CONE-H2-H1 N (EXTERNAL-CONE-CONE-H2-H1 N R A))
                    (EXTERNAL-CONE-CONE-H2-H1 (+ N -1)
                                              R (D-CONE-CONE-H2-H1 N A))))
        (IMPLIES (INTEGERP N)
                 (EQUAL (D-CONE-CONE-H2-H1 N (ZERO-CONE-CONE-H2-H1 N))
                        (ZERO-CONE-CONE-H2-H1 (+ N -1))))
        (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                      (INTEGERP N))
                 (EQUAL (D-CONE-CONE-H2-H1 N (INVERSE-CONE-CONE-H2-H1 N A))
                        (INVERSE-CONE-CONE-H2-H1 (+ N -1)
                                                 (D-CONE-CONE-H2-H1 N A)))))
       (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                     (INTEGERP N))
                (EQUAL (D-CONE-CONE-H2-H1 (1- N)
                                          (D-CONE-CONE-H2-H1 N A))
                       (ZERO-CONE-CONE-H2-H1 (1- (1- N)))))))
     (AND (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                        (INTEGERP N))
                   (INV-CONE-CONE-H2-H1 N (RF-CONES N A)))
          (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                        (INV-CONE-CONE-D2-D1 N B)
                        (INTEGERP N))
                   (EQUAL (RF-CONES N
                                    (GROUP-OPERATION-CONE-CONE-D2-D1 N A B))
                          (GROUP-OPERATION-CONE-CONE-H2-H1 N (RF-CONES N A)
                                                           (RF-CONES N B))))
          (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                        (INV-RING-Z R)
                        (INTEGERP N))
                   (EQUAL (RF-CONES N (EXTERNAL-CONE-CONE-D2-D1 N R A))
                          (EXTERNAL-CONE-CONE-H2-H1 N R (RF-CONES N A))))
          (IMPLIES (INTEGERP N)
                   (EQUAL (RF-CONES N (ZERO-CONE-CONE-D2-D1 N))
                          (ZERO-CONE-CONE-H2-H1 N)))
          (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                        (INTEGERP N))
                   (EQUAL (RF-CONES N (INVERSE-CONE-CONE-D2-D1 N A))
                          (INVERSE-CONE-CONE-H2-H1 N (RF-CONES N A)))))
     (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                   (INTEGERP N))
              (EQUAL (D-CONE-CONE-H2-H1 N (RF-CONES N A))
                     (RF-CONES (1- N)
                               (D-CONE-CONE-D2-D1 N A)))))
    (AND (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                       (INTEGERP N))
                  (INV-CONE-CONE-D2-D1 (+ N 1)
                                       (RH-CONES N A)))
         (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                       (INV-CONE-CONE-D2-D1 N B)
                       (INTEGERP N))
                  (EQUAL (RH-CONES N
                                   (GROUP-OPERATION-CONE-CONE-D2-D1 N A B))
                         (GROUP-OPERATION-CONE-CONE-D2-D1 (+ N 1)
                                                          (RH-CONES N A)
                                                          (RH-CONES N B))))
         (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                       (INV-RING-Z R)
                       (INTEGERP N))
                  (EQUAL (RH-CONES N (EXTERNAL-CONE-CONE-D2-D1 N R A))
                         (EXTERNAL-CONE-CONE-D2-D1 (+ N 1)
                                                   R (RH-CONES N A))))
         (IMPLIES (INTEGERP N)
                  (EQUAL (RH-CONES N (ZERO-CONE-CONE-D2-D1 N))
                         (ZERO-CONE-CONE-D2-D1 (+ N 1))))
         (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                       (INTEGERP N))
                  (EQUAL (RH-CONES N (INVERSE-CONE-CONE-D2-D1 N A))
                         (INVERSE-CONE-CONE-D2-D1 (+ N 1)
                                                  (RH-CONES N A)))))
    (AND
     (AND
      (AND
       (AND
        (AND
         (AND
            (AND (IMPLIES (AND (INV-RING-Z X) (INV-RING-Z Y))
                          (INV-RING-Z (ADDITION-RING-Z X Y)))
                 (IMPLIES (AND (INV-RING-Z X)
                               (INV-RING-Z Y)
                               (INV-RING-Z Z))
                          (EQUAL (ADDITION-RING-Z (ADDITION-RING-Z X Y)
                                                  Z)
                                 (ADDITION-RING-Z X (ADDITION-RING-Z Y Z)))))
            (IMPLIES (INV-RING-Z X)
                     (EQUAL (ADDITION-RING-Z (ZERO-ELEMENT-Z) X)
                            X))
            (IMPLIES (INV-RING-Z X)
                     (EQUAL (ADDITION-RING-Z X (ZERO-ELEMENT-Z))
                            X))
            (INV-RING-Z (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (EQUAL (ADDITION-RING-Z (INVERSE-Z X) X)
                         (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (EQUAL (ADDITION-RING-Z X (INVERSE-Z X))
                         (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (INV-RING-Z (INVERSE-Z X))))
        (AND (AND (IMPLIES (AND (INV-RING-Z X) (INV-RING-Z Y))
                           (INV-RING-Z (PRODUCT-RING-Z X Y)))
                  (IMPLIES (AND (INV-RING-Z X)
                                (INV-RING-Z Y)
                                (INV-RING-Z Z))
                           (EQUAL (PRODUCT-RING-Z (PRODUCT-RING-Z X Y) Z)
                                  (PRODUCT-RING-Z X (PRODUCT-RING-Z Y Z)))))
             (IMPLIES (INV-RING-Z X)
                      (EQUAL (PRODUCT-RING-Z (UNIT-Z) X) X))
             (IMPLIES (INV-RING-Z X)
                      (EQUAL (PRODUCT-RING-Z X (UNIT-Z)) X))
             (INV-RING-Z (UNIT-Z)))
        (IMPLIES (AND (INV-RING-Z X)
                      (INV-RING-Z Y)
                      (INV-RING-Z Z))
                 (EQUAL (PRODUCT-RING-Z X (ADDITION-RING-Z Y Z))
                        (ADDITION-RING-Z (PRODUCT-RING-Z X Y)
                                         (PRODUCT-RING-Z X Z))))
        (IMPLIES (AND (INV-RING-Z X)
                      (INV-RING-Z Y)
                      (INV-RING-Z Z))
                 (EQUAL (PRODUCT-RING-Z (ADDITION-RING-Z X Y) Z)
                        (ADDITION-RING-Z (PRODUCT-RING-Z X Z)
                                         (PRODUCT-RING-Z Y Z)))))
       (IMPLIES
            (AND (INV-CONE-CONE-H2-H1 N A)
                 (INV-CONE-CONE-H2-H1 N B)
                 (INTEGERP N))
            (INV-CONE-CONE-H2-H1 N
                                 (GROUP-OPERATION-CONE-CONE-H2-H1 N A B)))
       (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                     (INV-CONE-CONE-H2-H1 N B)
                     (INV-CONE-CONE-H2-H1 N C)
                     (INTEGERP N))
                (EQUAL (GROUP-OPERATION-CONE-CONE-H2-H1
                            N
                            (GROUP-OPERATION-CONE-CONE-H2-H1 N A B)
                            C)
                       (GROUP-OPERATION-CONE-CONE-H2-H1
                            N A
                            (GROUP-OPERATION-CONE-CONE-H2-H1 N B C))))
       (INV-CONE-CONE-H2-H1 N (ZERO-CONE-CONE-H2-H1 N))
       (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                     (INV-RING-Z R)
                     (INTEGERP N))
                (INV-CONE-CONE-H2-H1 N (EXTERNAL-CONE-CONE-H2-H1 N R A)))
       (IMPLIES
        (AND (INV-CONE-CONE-H2-H1 N A)
             (INTEGERP N))
        (EQUAL (GROUP-OPERATION-CONE-CONE-H2-H1 N A (ZERO-CONE-CONE-H2-H1 N))
               A))
       (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                     (INTEGERP N))
                (INV-CONE-CONE-H2-H1 N (INVERSE-CONE-CONE-H2-H1 N A)))
       (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                     (INV-CONE-CONE-H2-H1 N B)
                     (INTEGERP N)
                     (EQUAL (GROUP-OPERATION-CONE-CONE-H2-H1 N A B)
                            (ZERO-CONE-CONE-H2-H1 N)))
                (EQUAL (INVERSE-CONE-CONE-H2-H1 N A) B))
       (IMPLIES
        (AND (INV-CONE-CONE-H2-H1 N A)
             (INTEGERP N))
        (EQUAL
          (GROUP-OPERATION-CONE-CONE-H2-H1 N A (INVERSE-CONE-CONE-H2-H1 N A))
          (ZERO-CONE-CONE-H2-H1 N)))
       (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                     (INV-CONE-CONE-H2-H1 N B)
                     (INTEGERP N))
                (EQUAL (GROUP-OPERATION-CONE-CONE-H2-H1 N A B)
                       (GROUP-OPERATION-CONE-CONE-H2-H1 N B A)))
       (IMPLIES
        (AND (INV-CONE-CONE-H2-H1 N A)
             (INV-CONE-CONE-H2-H1 N B)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
         (EXTERNAL-CONE-CONE-H2-H1 N R
                                   (GROUP-OPERATION-CONE-CONE-H2-H1 N A B))
         (GROUP-OPERATION-CONE-CONE-H2-H1 N (EXTERNAL-CONE-CONE-H2-H1 N R A)
                                          (EXTERNAL-CONE-CONE-H2-H1 N R B))))
       (IMPLIES
        (AND (INV-CONE-CONE-H2-H1 N A)
             (INV-RING-Z S)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
         (EXTERNAL-CONE-CONE-H2-H1 N (ADDITION-RING-Z S R)
                                   A)
         (GROUP-OPERATION-CONE-CONE-H2-H1 N (EXTERNAL-CONE-CONE-H2-H1 N S A)
                                          (EXTERNAL-CONE-CONE-H2-H1 N R A))))
       (IMPLIES
        (AND (INV-CONE-CONE-H2-H1 N A)
             (INV-RING-Z S)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
            (EXTERNAL-CONE-CONE-H2-H1 N (PRODUCT-RING-Z S R)
                                      A)
            (EXTERNAL-CONE-CONE-H2-H1 N S (EXTERNAL-CONE-CONE-H2-H1 N R A))))
       (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                     (INTEGERP N))
                (EQUAL (EXTERNAL-CONE-CONE-H2-H1 N (UNIT-Z) A)
                       A))
       (IMPLIES
        (AND (INV-CONE-CONE-H2-H1 N A)
             (INV-CONE-CONE-H2-H1 N B)
             (INTEGERP N))
        (EQUAL
            (INVERSE-CONE-CONE-H2-H1 N
                                     (GROUP-OPERATION-CONE-CONE-H2-H1 N A B))
            (GROUP-OPERATION-CONE-CONE-H2-H1 N (INVERSE-CONE-CONE-H2-H1 N A)
                                             (INVERSE-CONE-CONE-H2-H1 N B))))
       (IMPLIES
        (AND (INV-CONE-CONE-H2-H1 N A)
             (INV-RING-Z S)
             (INTEGERP N))
        (EQUAL (INVERSE-CONE-CONE-H2-H1 N (EXTERNAL-CONE-CONE-H2-H1 N S A))
               (EXTERNAL-CONE-CONE-H2-H1 N S (INVERSE-CONE-CONE-H2-H1 N A))))
       (IMPLIES (INTEGERP N)
                (EQUAL (INVERSE-CONE-CONE-H2-H1 N (ZERO-CONE-CONE-H2-H1 N))
                       (ZERO-CONE-CONE-H2-H1 N)))
       (IMPLIES
            (AND (INV-RING-Z S) (INTEGERP N))
            (EQUAL (EXTERNAL-CONE-CONE-H2-H1 N S (ZERO-CONE-CONE-H2-H1 N))
                   (ZERO-CONE-CONE-H2-H1 N))))
      (AND
       (AND
        (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                      (INTEGERP N))
                 (INV-CONE-CONE-H2-H1 (+ N -1)
                                      (D-CONE-CONE-H2-H1 N A)))
        (IMPLIES
           (AND (INV-CONE-CONE-H2-H1 N A)
                (INV-CONE-CONE-H2-H1 N B)
                (INTEGERP N))
           (EQUAL (D-CONE-CONE-H2-H1 N
                                     (GROUP-OPERATION-CONE-CONE-H2-H1 N A B))
                  (GROUP-OPERATION-CONE-CONE-H2-H1 (+ N -1)
                                                   (D-CONE-CONE-H2-H1 N A)
                                                   (D-CONE-CONE-H2-H1 N B))))
        (IMPLIES
             (AND (INV-CONE-CONE-H2-H1 N A)
                  (INV-RING-Z R)
                  (INTEGERP N))
             (EQUAL (D-CONE-CONE-H2-H1 N (EXTERNAL-CONE-CONE-H2-H1 N R A))
                    (EXTERNAL-CONE-CONE-H2-H1 (+ N -1)
                                              R (D-CONE-CONE-H2-H1 N A))))
        (IMPLIES (INTEGERP N)
                 (EQUAL (D-CONE-CONE-H2-H1 N (ZERO-CONE-CONE-H2-H1 N))
                        (ZERO-CONE-CONE-H2-H1 (+ N -1))))
        (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                      (INTEGERP N))
                 (EQUAL (D-CONE-CONE-H2-H1 N (INVERSE-CONE-CONE-H2-H1 N A))
                        (INVERSE-CONE-CONE-H2-H1 (+ N -1)
                                                 (D-CONE-CONE-H2-H1 N A)))))
       (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                     (INTEGERP N))
                (EQUAL (D-CONE-CONE-H2-H1 (1- N)
                                          (D-CONE-CONE-H2-H1 N A))
                       (ZERO-CONE-CONE-H2-H1 (1- (1- N)))))))
     (AND
      (AND
       (AND
        (AND
         (AND
            (AND (IMPLIES (AND (INV-RING-Z X) (INV-RING-Z Y))
                          (INV-RING-Z (ADDITION-RING-Z X Y)))
                 (IMPLIES (AND (INV-RING-Z X)
                               (INV-RING-Z Y)
                               (INV-RING-Z Z))
                          (EQUAL (ADDITION-RING-Z (ADDITION-RING-Z X Y)
                                                  Z)
                                 (ADDITION-RING-Z X (ADDITION-RING-Z Y Z)))))
            (IMPLIES (INV-RING-Z X)
                     (EQUAL (ADDITION-RING-Z (ZERO-ELEMENT-Z) X)
                            X))
            (IMPLIES (INV-RING-Z X)
                     (EQUAL (ADDITION-RING-Z X (ZERO-ELEMENT-Z))
                            X))
            (INV-RING-Z (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (EQUAL (ADDITION-RING-Z (INVERSE-Z X) X)
                         (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (EQUAL (ADDITION-RING-Z X (INVERSE-Z X))
                         (ZERO-ELEMENT-Z)))
         (IMPLIES (INV-RING-Z X)
                  (INV-RING-Z (INVERSE-Z X))))
        (AND (AND (IMPLIES (AND (INV-RING-Z X) (INV-RING-Z Y))
                           (INV-RING-Z (PRODUCT-RING-Z X Y)))
                  (IMPLIES (AND (INV-RING-Z X)
                                (INV-RING-Z Y)
                                (INV-RING-Z Z))
                           (EQUAL (PRODUCT-RING-Z (PRODUCT-RING-Z X Y) Z)
                                  (PRODUCT-RING-Z X (PRODUCT-RING-Z Y Z)))))
             (IMPLIES (INV-RING-Z X)
                      (EQUAL (PRODUCT-RING-Z (UNIT-Z) X) X))
             (IMPLIES (INV-RING-Z X)
                      (EQUAL (PRODUCT-RING-Z X (UNIT-Z)) X))
             (INV-RING-Z (UNIT-Z)))
        (IMPLIES (AND (INV-RING-Z X)
                      (INV-RING-Z Y)
                      (INV-RING-Z Z))
                 (EQUAL (PRODUCT-RING-Z X (ADDITION-RING-Z Y Z))
                        (ADDITION-RING-Z (PRODUCT-RING-Z X Y)
                                         (PRODUCT-RING-Z X Z))))
        (IMPLIES (AND (INV-RING-Z X)
                      (INV-RING-Z Y)
                      (INV-RING-Z Z))
                 (EQUAL (PRODUCT-RING-Z (ADDITION-RING-Z X Y) Z)
                        (ADDITION-RING-Z (PRODUCT-RING-Z X Z)
                                         (PRODUCT-RING-Z Y Z)))))
       (IMPLIES
            (AND (INV-CONE-CONE-D2-D1 N A)
                 (INV-CONE-CONE-D2-D1 N B)
                 (INTEGERP N))
            (INV-CONE-CONE-D2-D1 N
                                 (GROUP-OPERATION-CONE-CONE-D2-D1 N A B)))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INV-CONE-CONE-D2-D1 N B)
                     (INV-CONE-CONE-D2-D1 N C)
                     (INTEGERP N))
                (EQUAL (GROUP-OPERATION-CONE-CONE-D2-D1
                            N
                            (GROUP-OPERATION-CONE-CONE-D2-D1 N A B)
                            C)
                       (GROUP-OPERATION-CONE-CONE-D2-D1
                            N A
                            (GROUP-OPERATION-CONE-CONE-D2-D1 N B C))))
       (INV-CONE-CONE-D2-D1 N (ZERO-CONE-CONE-D2-D1 N))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INV-RING-Z R)
                     (INTEGERP N))
                (INV-CONE-CONE-D2-D1 N (EXTERNAL-CONE-CONE-D2-D1 N R A)))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INTEGERP N))
        (EQUAL (GROUP-OPERATION-CONE-CONE-D2-D1 N A (ZERO-CONE-CONE-D2-D1 N))
               A))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INTEGERP N))
                (INV-CONE-CONE-D2-D1 N (INVERSE-CONE-CONE-D2-D1 N A)))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INV-CONE-CONE-D2-D1 N B)
                     (INTEGERP N)
                     (EQUAL (GROUP-OPERATION-CONE-CONE-D2-D1 N A B)
                            (ZERO-CONE-CONE-D2-D1 N)))
                (EQUAL (INVERSE-CONE-CONE-D2-D1 N A) B))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INTEGERP N))
        (EQUAL
          (GROUP-OPERATION-CONE-CONE-D2-D1 N A (INVERSE-CONE-CONE-D2-D1 N A))
          (ZERO-CONE-CONE-D2-D1 N)))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INV-CONE-CONE-D2-D1 N B)
                     (INTEGERP N))
                (EQUAL (GROUP-OPERATION-CONE-CONE-D2-D1 N A B)
                       (GROUP-OPERATION-CONE-CONE-D2-D1 N B A)))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INV-CONE-CONE-D2-D1 N B)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
         (EXTERNAL-CONE-CONE-D2-D1 N R
                                   (GROUP-OPERATION-CONE-CONE-D2-D1 N A B))
         (GROUP-OPERATION-CONE-CONE-D2-D1 N (EXTERNAL-CONE-CONE-D2-D1 N R A)
                                          (EXTERNAL-CONE-CONE-D2-D1 N R B))))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INV-RING-Z S)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
         (EXTERNAL-CONE-CONE-D2-D1 N (ADDITION-RING-Z S R)
                                   A)
         (GROUP-OPERATION-CONE-CONE-D2-D1 N (EXTERNAL-CONE-CONE-D2-D1 N S A)
                                          (EXTERNAL-CONE-CONE-D2-D1 N R A))))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INV-RING-Z S)
             (INV-RING-Z R)
             (INTEGERP N))
        (EQUAL
            (EXTERNAL-CONE-CONE-D2-D1 N (PRODUCT-RING-Z S R)
                                      A)
            (EXTERNAL-CONE-CONE-D2-D1 N S (EXTERNAL-CONE-CONE-D2-D1 N R A))))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INTEGERP N))
                (EQUAL (EXTERNAL-CONE-CONE-D2-D1 N (UNIT-Z) A)
                       A))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INV-CONE-CONE-D2-D1 N B)
             (INTEGERP N))
        (EQUAL
            (INVERSE-CONE-CONE-D2-D1 N
                                     (GROUP-OPERATION-CONE-CONE-D2-D1 N A B))
            (GROUP-OPERATION-CONE-CONE-D2-D1 N (INVERSE-CONE-CONE-D2-D1 N A)
                                             (INVERSE-CONE-CONE-D2-D1 N B))))
       (IMPLIES
        (AND (INV-CONE-CONE-D2-D1 N A)
             (INV-RING-Z S)
             (INTEGERP N))
        (EQUAL (INVERSE-CONE-CONE-D2-D1 N (EXTERNAL-CONE-CONE-D2-D1 N S A))
               (EXTERNAL-CONE-CONE-D2-D1 N S (INVERSE-CONE-CONE-D2-D1 N A))))
       (IMPLIES (INTEGERP N)
                (EQUAL (INVERSE-CONE-CONE-D2-D1 N (ZERO-CONE-CONE-D2-D1 N))
                       (ZERO-CONE-CONE-D2-D1 N)))
       (IMPLIES
            (AND (INV-RING-Z S) (INTEGERP N))
            (EQUAL (EXTERNAL-CONE-CONE-D2-D1 N S (ZERO-CONE-CONE-D2-D1 N))
                   (ZERO-CONE-CONE-D2-D1 N))))
      (AND
       (AND
        (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                      (INTEGERP N))
                 (INV-CONE-CONE-D2-D1 (+ N -1)
                                      (D-CONE-CONE-D2-D1 N A)))
        (IMPLIES
           (AND (INV-CONE-CONE-D2-D1 N A)
                (INV-CONE-CONE-D2-D1 N B)
                (INTEGERP N))
           (EQUAL (D-CONE-CONE-D2-D1 N
                                     (GROUP-OPERATION-CONE-CONE-D2-D1 N A B))
                  (GROUP-OPERATION-CONE-CONE-D2-D1 (+ N -1)
                                                   (D-CONE-CONE-D2-D1 N A)
                                                   (D-CONE-CONE-D2-D1 N B))))
        (IMPLIES
             (AND (INV-CONE-CONE-D2-D1 N A)
                  (INV-RING-Z R)
                  (INTEGERP N))
             (EQUAL (D-CONE-CONE-D2-D1 N (EXTERNAL-CONE-CONE-D2-D1 N R A))
                    (EXTERNAL-CONE-CONE-D2-D1 (+ N -1)
                                              R (D-CONE-CONE-D2-D1 N A))))
        (IMPLIES (INTEGERP N)
                 (EQUAL (D-CONE-CONE-D2-D1 N (ZERO-CONE-CONE-D2-D1 N))
                        (ZERO-CONE-CONE-D2-D1 (+ N -1))))
        (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                      (INTEGERP N))
                 (EQUAL (D-CONE-CONE-D2-D1 N (INVERSE-CONE-CONE-D2-D1 N A))
                        (INVERSE-CONE-CONE-D2-D1 (+ N -1)
                                                 (D-CONE-CONE-D2-D1 N A)))))
       (IMPLIES (AND (INV-CONE-CONE-D2-D1 N A)
                     (INTEGERP N))
                (EQUAL (D-CONE-CONE-D2-D1 (1- N)
                                          (D-CONE-CONE-D2-D1 N A))
                       (ZERO-CONE-CONE-D2-D1 (1- (1- N)))))))
     (AND (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                        (INTEGERP N))
                   (INV-CONE-CONE-D2-D1 N (RG-CONES N A)))
          (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                        (INV-CONE-CONE-H2-H1 N B)
                        (INTEGERP N))
                   (EQUAL (RG-CONES N
                                    (GROUP-OPERATION-CONE-CONE-H2-H1 N A B))
                          (GROUP-OPERATION-CONE-CONE-D2-D1 N (RG-CONES N A)
                                                           (RG-CONES N B))))
          (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                        (INV-RING-Z R)
                        (INTEGERP N))
                   (EQUAL (RG-CONES N (EXTERNAL-CONE-CONE-H2-H1 N R A))
                          (EXTERNAL-CONE-CONE-D2-D1 N R (RG-CONES N A))))
          (IMPLIES (INTEGERP N)
                   (EQUAL (RG-CONES N (ZERO-CONE-CONE-H2-H1 N))
                          (ZERO-CONE-CONE-D2-D1 N)))
          (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                        (INTEGERP N))
                   (EQUAL (RG-CONES N (INVERSE-CONE-CONE-H2-H1 N A))
                          (INVERSE-CONE-CONE-D2-D1 N (RG-CONES N A)))))
     (IMPLIES (AND (INV-CONE-CONE-H2-H1 N A)
                   (INTEGERP N))
              (EQUAL (D-CONE-CONE-D2-D1 N (RG-CONES N A))
                     (RG-CONES (1- N)
                               (D-CONE-CONE-H2-H1 N A)))))
    (IMPLIES (AND (INV-CONE-CONE-H2-H1 N GNRT)
                  (INTEGERP N))
             (EQUAL (RF-CONES N (RG-CONES N GNRT))
                    GNRT))
    (IMPLIES
     (AND (INV-CONE-CONE-D2-D1 N GNRT)
          (INTEGERP N))
     (EQUAL
      (GROUP-OPERATION-CONE-CONE-D2-D1 N
                                       (RH-CONES (1- N)
                                                 (D-CONE-CONE-D2-D1 N GNRT))
                                       (D-CONE-CONE-D2-D1 (1+ N)
                                                          (RH-CONES N GNRT)))
      (GROUP-OPERATION-CONE-CONE-D2-D1
           N GNRT
           (INVERSE-CONE-CONE-D2-D1 N (RG-CONES N (RF-CONES N GNRT))))))
    (IMPLIES (AND (INV-CONE-CONE-D2-D1 N GNRT)
                  (INTEGERP N))
             (EQUAL (RF-CONES (1+ N) (RH-CONES N GNRT))
                    (ZERO-CONE-CONE-H2-H1 (1+ N))))
    (IMPLIES (AND (INV-CONE-CONE-H2-H1 N GNRT)
                  (INTEGERP N))
             (EQUAL (RH-CONES N (RG-CONES N GNRT))
                    (ZERO-CONE-CONE-D2-D1 (1+ N))))
    (IMPLIES (AND (INV-CONE-CONE-D2-D1 N GNRT)
                  (INTEGERP N))
             (EQUAL (RH-CONES (1+ N) (RH-CONES N GNRT))
                    (ZERO-CONE-CONE-D2-D1 (1+ (1+ N)))))))
  :HINTS (("Subgoal 48" :USE ((:INSTANCE AUX-BIS)))
          ("Subgoal 4" :USE ((:INSTANCE LEMMA-AUX-62)
                             (:INSTANCE LEMMA-AUX-80)))))))


(make-generic-theory *CONE-REDUCTION-THEOREM*)